Interface StreamResourceFactory<T extends @NonNull AutoCloseable>

Type Parameters:
T - the resource type
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

Opens a resource for a streaming operation, allowing checked acquisition failures.

Each invocation must return an independently owned resource. A reusable streaming descriptor may invoke the same factory concurrently for different responses; the factory is responsible for the safety of its captured state. The receiving API defines when acquisition occurs and how the returned resource is closed or aborted.

If acquisition fails before returning a resource, the factory is responsible for cleaning up any partially acquired state. Implementing AutoCloseable alone does not guarantee that a resource can safely be closed while another thread is using it.

Author:
Mark Allen
  • Method Summary

    Modifier and Type
    Method
    Description
    Opens a resource for one streaming operation.
  • Method Details

    • open

      Opens a resource for one streaming operation.
      Returns:
      the newly owned resource
      Throws:
      Exception - if acquisition fails