Package org.apache.sshd.common.future
Class GlobalRequestFuture
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.future.AbstractSshFuture<T>
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
.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
AReplyHandler
is invoked asynchronously when the reply for a request withwant-reply = true
is received. -
Field Summary
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Constructor Summary
ConstructorDescriptionGlobalRequestFuture
(String request) Creates a newGlobalRequestFuture
for a global request.GlobalRequestFuture
(String request, GlobalRequestFuture.ReplyHandler handler) Creates a newGlobalRequestFuture
for a global request. -
Method Summary
Modifier and TypeMethodDescriptionObtains the replyBuffer
if the request was successful.Retrieves an exception if the request failed.Retrieves theGlobalRequestFuture.ReplyHandler
of this future, if any.getId()
long
Retrieves this future's packet sequence number.void
operationComplete
(IoWriteFuture future) void
setSequenceNumber
(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, setValue
Methods inherited from class org.apache.sshd.common.future.AbstractSshFuture
asListener, asT, await, awaitUninterruptibly, formatExceptionMessage, notifyListener, verifyResult
Methods 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, warn
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.sshd.common.future.WaitableFuture
await, await, await, await, await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly
-
Constructor Details
-
GlobalRequestFuture
Creates a newGlobalRequestFuture
for 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 newGlobalRequestFuture
for 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:
getId
in interfaceWaitableFuture
- Overrides:
getId
in classAbstractSshFuture<GlobalRequestFuture>
-
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.ReplyHandler
of this future, if any.- Returns:
- the handler, or
null
if none was set
-
getBuffer
Obtains the replyBuffer
if the request was successful. If called afterDefaultSshFuture.isDone()
istrue
, a non-null
result means the request was successful.- Returns:
- the
Buffer
, ornull
if 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
, anull
result means the request did not fail.- Returns:
- a failure reason, or
null
if there isn't one or if the request did not fail
-
operationComplete
- Specified by:
operationComplete
in interfaceSshFutureListener<IoWriteFuture>
-
toString
- Overrides:
toString
in classDefaultSshFuture<GlobalRequestFuture>
-