Top Description Methods
org.apache.sshd.common

public Interface Closeable

extends Channel
Known Direct Subinterfaces
org.apache.sshd.common.io.IoInputStream, org.apache.sshd.common.io.IoOutputStream, org.apache.sshd.common.io.IoService, org.apache.sshd.common.io.IoServiceFactory, org.apache.sshd.common.io.IoSession, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.threads.CloseableExecutorService
Known Direct Implementers
org.apache.sshd.common.util.closeable.IoBaseCloseable
Imports
java.io.IOException, java.net.SocketTimeoutException, java.nio.channels.Channel, java.time.Duration, org.apache.sshd.common.future.CloseFuture, .SshFutureListener

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)
Author
Apache MINA SSHD Project

Method Summary

Modifier and TypeMethod and Description
public void
addCloseFutureListener(SshFutureListener<CloseFuture>
The notification SshFutureListener - never null
listener
)

Pre-register a listener to be informed when resource is closed.

public CloseFuture

Returns:

a CloseFuture representing the close request
close
(boolean
true if the resource should be shut down abruptly, false for a graceful close
immediately
)

Close this resource asynchronously and return a future.

public default void
close()

Implements java.nio.channels.Channel.close.

Closes this channel.

public static void
close(Closeable closeable)

public static Duration
public boolean

Returns:

true if closing
isClosed
()

Returns true if this object has been closed.

public boolean

Returns:

true if closing
isClosing
()

Returns true if the close(boolean) method has been called.

public default boolean
isOpen()

Implements java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

public void
removeCloseFutureListener(SshFutureListener<CloseFuture>
The register SshFutureListener - never null. Ignored if not registered or resource already closed
listener
)

Remove a pre-registered close event listener

Method Detail

addCloseFutureListenerback to summary
public 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:SshFutureListener<CloseFuture>

The notification SshFutureListener - never null

closeback to summary
public 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:boolean

true if the resource should be shut down abruptly, false for a graceful close

Returns:CloseFuture

a CloseFuture representing the close request

closeback to summary
public default void close() throws IOException

Implements java.nio.channels.Channel.close.

Doc from java.nio.channels.Channel.close.

Closes this channel.

After a channel is closed, any further attempt to invoke I/O operations upon it will cause a ClosedChannelException to be thrown.

If this channel is already closed then invoking this method has no effect.

This method may be invoked at any time. If some other thread has already invoked it, however, then another invocation will block until the first invocation is complete, after which it will return without effect.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
closeback to summary
public static void close(Closeable closeable) throws IOException
getMaxCloseWaitTimeback to summary
public static Duration getMaxCloseWaitTime(PropertyResolver resolver)
isClosedback to summary
public boolean isClosed()

Returns true if this object has been closed.

Returns:boolean

true if closing

isClosingback to summary
public 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:boolean

true if closing

isOpenback to summary
public default boolean isOpen()

Implements java.nio.channels.Channel.isOpen.

Doc from java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

Returns:boolean

true if, and only if, this channel is open

Annotations
@Override
removeCloseFutureListenerback to summary
public void removeCloseFutureListener(SshFutureListener<CloseFuture> listener)

Remove a pre-registered close event listener

Parameters
listener:SshFutureListener<CloseFuture>

The register SshFutureListener - never null. Ignored if not registered or resource already closed