Interface Closeable

    • Method Detail

      • close

        CloseFuture close​(boolean immediately)
        Close this resource asynchronously and return a future. Resources support two closing modes: a graceful mode which will cleanly close the resource and an immediate mode which will close the resources abruptly.
        Parameters:
        immediately - true if the resource should be shut down abruptly, false for a graceful close
        Returns:
        a CloseFuture representing the close request
      • addCloseFutureListener

        void addCloseFutureListener​(SshFutureListener<CloseFuture> listener)
        Pre-register a listener to be informed when resource is closed. If resource is already closed, the listener will be invoked immediately and not registered for future notification
        Parameters:
        listener - The notification SshFutureListener - never null
      • removeCloseFutureListener

        void removeCloseFutureListener​(SshFutureListener<CloseFuture> listener)
        Remove a pre-registered close event listener
        Parameters:
        listener - The register SshFutureListener - never null. Ignored if not registered or resource already closed
      • isClosed

        boolean isClosed()
        Returns true if this object has been closed.
        Returns:
        true if closing
      • isClosing

        boolean isClosing()
        Returns true if the close(boolean) method has been called. Note that this method will return true even if this isClosed() returns true.
        Returns:
        true if closing
      • isOpen

        default boolean isOpen()
        Specified by:
        isOpen in interface java.nio.channels.Channel
      • close

        default void close()
                    throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.nio.channels.Channel
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • getMaxCloseWaitTime

        static java.time.Duration getMaxCloseWaitTime​(PropertyResolver resolver)
      • close

        static void close​(Closeable closeable)
                   throws java.io.IOException
        Throws:
        java.io.IOException