Package org.apache.sshd.common.future
Class GlobalRequestFuture
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.future.AbstractSshFuture<GlobalRequestFuture>
org.apache.sshd.common.future.DefaultSshFuture<GlobalRequestFuture>
org.apache.sshd.common.future.GlobalRequestFuture
- All Implemented Interfaces:
EventListener,SshFuture<GlobalRequestFuture>,SshFutureListener<IoWriteFuture>,WaitableFuture,SshdEventListener
public class GlobalRequestFuture
extends DefaultSshFuture<GlobalRequestFuture>
implements SshFutureListener<IoWriteFuture>
A
DefaultSshFuture that can be used to wait for the reply of an SSH_MSG_GLOBAL_REQUEST sent with
want-reply = true.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAReplyHandleris invoked asynchronously when the reply for a request withwant-reply = trueis received. -
Field Summary
FieldsFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
ConstructorsConstructorDescriptionGlobalRequestFuture(String request) Creates a newGlobalRequestFuturefor a global request.GlobalRequestFuture(String request, GlobalRequestFuture.ReplyHandler handler) Creates a newGlobalRequestFuturefor a global request. -
Method Summary
Modifier and TypeMethodDescriptionObtains the replyBufferif the request was successful.Retrieves an exception if the request failed.Retrieves theGlobalRequestFuture.ReplyHandlerof this future, if any.getId()longRetrieves this future's packet sequence number.voidoperationComplete(IoWriteFuture future) Invoked when the operation associated with theSshFuturehas been completed even if you add the listener after the completion.voidsetSequenceNumber(long number) Sets the packet sequence number of the global request represented by this future.toString()Methods inherited from class org.apache.sshd.common.future.DefaultSshFuture
addListener, await0, createCancellation, getNumRegisteredListeners, getValue, isDone, notifyListeners, onValueSet, removeListener, setValueMethods inherited from class org.apache.sshd.common.future.AbstractSshFuture
asListener, asT, await, awaitUninterruptibly, formatExceptionMessage, notifyListener, verifyResultMethods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sshd.common.future.WaitableFuture
await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly
-
Field Details
-
handler
-
sequenceNumber
private long sequenceNumber
-
-
Constructor Details
-
GlobalRequestFuture
Creates a newGlobalRequestFuturefor a global request. Synchronization occurs on the future itself. The future will be fulfilled once the reply has been received or an error occurred.- Parameters:
request- the request identifier
-
GlobalRequestFuture
Creates a newGlobalRequestFuturefor a global request. Synchronization occurs on the future itself. The future will be fulfilled once the request has been sent, or an error occurred during sending. The framework will invoke the handler once the reply has been received. For global requests withwant-reply = false, the handler will be invoked with an empty buffer if the request was successfully sent.- Parameters:
request- the request identifierhandler- theGlobalRequestFuture.ReplyHandler, ornull
-
-
Method Details
-
getId
- Specified by:
getIdin interfaceWaitableFuture- Overrides:
getIdin classAbstractSshFuture<GlobalRequestFuture>- Returns:
- Some identifier useful as
toString()value
-
getSequenceNumber
public long getSequenceNumber()Retrieves this future's packet sequence number.- Returns:
- the sequence number
-
setSequenceNumber
public void setSequenceNumber(long number) Sets the packet sequence number of the global request represented by this future.- Parameters:
number- the packet sequence number- Throws:
IllegalArgumentException- if the number given is not an unsigned 32bit value
-
getHandler
Retrieves theGlobalRequestFuture.ReplyHandlerof this future, if any.- Returns:
- the handler, or
nullif none was set
-
getBuffer
Obtains the replyBufferif the request was successful. If called afterDefaultSshFuture.isDone()istrue, a non-nullresult means the request was successful.- Returns:
- the
Buffer, ornullif the request was not successful or the reply was not received yet
-
getException
Retrieves an exception if the request failed. If called afterDefaultSshFuture.isDone()istrue, anullresult means the request did not fail.- Returns:
- a failure reason, or
nullif there isn't one or if the request did not fail
-
operationComplete
Description copied from interface:SshFutureListenerInvoked when the operation associated with theSshFuturehas been completed even if you add the listener after the completion.- Specified by:
operationCompletein interfaceSshFutureListener<IoWriteFuture>- Parameters:
future- The sourceSshFuturewhich called this callback.
-
toString
- Overrides:
toStringin classDefaultSshFuture<GlobalRequestFuture>
-