Package org.apache.sshd.common
Interface Closeable
- All Superinterfaces:
AutoCloseable,Channel,Closeable
- All Known Subinterfaces:
AgentForwardSupport,Channel,ClientChannel,ClientSession,CloseableExecutorService,ConnectionService,Forwarder,IoAcceptor,IoConnector,IoInputStream,IoOutputStream,IoService,IoServiceFactory,IoSession,ServerChannel,ServerSession,Service,Session,SessionContext,X11ForwardSupport
- All Known Implementing Classes:
AbstractChannel,AbstractChannel.GracefulChannelCloseable,AbstractClientChannel,AbstractClientChannel.NullIoInputStream,AbstractClientSession,AbstractCloseable,AbstractConnectionService,AbstractFactoryManager,AbstractInnerCloseable,AbstractIoServiceFactory,AbstractKexFactoryManager,AbstractServerChannel,AbstractServerSession,AbstractSession,AgentForwardedChannel,BufferedIoOutputStream,ChannelAgentForwarding,ChannelAsyncInputStream,ChannelAsyncOutputStream,ChannelDirectTcpip,ChannelExec,ChannelForwardedX11,ChannelSession,ChannelSession,ChannelSession.CommandCloseable,ChannelShell,ChannelSubsystem,ClientConnectionService,ClientSessionImpl,ClientUserAuthService,DefaultAgentForwardSupport,DefaultForwarder,DefaultSftpClient.SftpChannelSubsystem,DefaultX11ForwardSupport,FuturesCloseable,IoBaseCloseable,Nio2Acceptor,Nio2Connector,Nio2Service,Nio2ServiceFactory,Nio2Session,NoCloseExecutor,ParallelCloseable,PtyCapableChannelSession,SequentialCloseable,ServerConnectionService,ServerSessionImpl,ServerUserAuthService,SessionHelper,SimpleCloseable,SimpleIoOutputStream,SocksProxy,SshClient,SshServer,SshThreadPoolExecutor,SshThreadPoolExecutor.DelegateCloseable,TcpipClientChannel,TcpipServerChannel
A
Closeable is a resource that can be closed. The close method is invoked to release resources that the
object is holding. The user can pre-register listeners to be notified when resource close is completed (successfully
or otherwise)-
Method Summary
Modifier and TypeMethodDescriptionvoidaddCloseFutureListener(SshFutureListener<CloseFuture> listener) Pre-register a listener to be informed when resource is closed.default voidclose()close(boolean immediately) Close this resource asynchronously and return a future.static voidstatic DurationgetMaxCloseWaitTime(PropertyResolver resolver) booleanisClosed()Returnstrueif this object has been closed.booleanReturnstrueif theclose(boolean)method has been called.default booleanisOpen()voidRemove a pre-registered close event listener
-
Method Details
-
close
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-trueif the resource should be shut down abruptly,falsefor a graceful close- Returns:
- a
CloseFuturerepresenting the close request
-
addCloseFutureListener
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 notificationSshFutureListener- nevernull
-
removeCloseFutureListener
Remove a pre-registered close event listener- Parameters:
listener- The registerSshFutureListener- nevernull. Ignored if not registered or resource already closed
-
isClosed
boolean isClosed()Returnstrueif this object has been closed.- Returns:
trueif closing
-
isClosing
boolean isClosing()Returnstrueif theclose(boolean)method has been called. Note that this method will returntrueeven if thisisClosed()returnstrue.- Returns:
trueif closing
-
isOpen
default boolean isOpen() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getMaxCloseWaitTime
-
close
- Throws:
IOException
-