Interface AsyncCloseable

  • All Superinterfaces:
    AutoCloseable, Closeable

    public interface AsyncCloseable
    extends Closeable
    Async closeable interface. In some case, resource close is an async operation and not elegantly capture IOException within #close method. AsyncCloseable try to add listener handle close failure and provide utility indicate close status. But it isn't a good idea close streams and resources within try with resource block.
    • Method Detail

      • isClosed

        boolean isClosed()
        Return true when streams and resources close completely, false otherwise.
      • addCloseListener

        void addCloseListener​(BiConsumer<Void,​Exception> closeListener)
        Add failure listener for handling close exception.
        Parameters:
        closeListener - failure listener.