Interface AsyncCloseable

  • All Known Subinterfaces:
    AsyncIterator<T>
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface AsyncCloseable
    Copy of com.ibm.asyncutil.util.AsyncClosable in com.ibm.async:asyncutil:0.1.0 with minor changes to the java doc.

    An object that may hold resources that must be explicitly released, where the release may be performed asynchronously.

    Examples of such resources are manually managed memory, open file handles, socket descriptors etc. While similar to AutoCloseable, this interface should be used when the resource release operation may possibly be async. For example, if an object is thread-safe and has many consumers, an implementation may require all current ongoing operations to complete before resources are relinquished.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletionStage<java.lang.Void> close()
      Relinquishes any resources associated with this object.
    • Method Detail

      • close

        java.util.concurrent.CompletionStage<java.lang.Void> close()
        Relinquishes any resources associated with this object.
        Returns:
        a CompletionStage that completes when all resources associated with this object have been released, or with an exception if the resources cannot be released.