Interface HandleableCloseable<T>

    • Method Detail

      • close

        void close()
            throws IOException
        Close this resource. Call any registered close handlers. Calling this method more than once will not have any additional effect.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Throws:
        IOException - if the close failed
      • awaitClosedUninterruptibly

        void awaitClosedUninterruptibly()
        Wait for a resource close to complete.
      • closeAsync

        void closeAsync()
        Asynchronously close this resource. Returns immediately.
      • addCloseHandler

        HandleableCloseable.Key addCloseHandler​(CloseHandler<? super T> handler)
        Add a handler that will be called upon close. If the resource is already closed, the handler will be called immediately.
        Parameters:
        handler - the close handler
        Returns:
        a key which may be used to later remove this handler
      • isOpen

        boolean isOpen()
        Read the status of this resource. This is just a snapshot in time; there is no guarantee that the resource will remain open for any amount of time, even if this method returns true.
        Returns:
        true if the resource is still open