public class GlobalRequestFuture extends DefaultSshFuture<GlobalRequestFuture> implements SshFutureListener<IoWriteFuture>
DefaultSshFuture
that can be used to wait for the reply of an SSH_MSG_GLOBAL_REQUEST sent with
want-reply = true
.org.apache.sshd.common.session.Session#request(Buffer, String, ReplyHandler)}
Modifier and Type | Class and Description |
---|---|
static interface |
GlobalRequestFuture.ReplyHandler
A
ReplyHandler is invoked asynchronously when the reply for a request with want-reply = true is
received. |
CANCELED
log
Constructor and Description |
---|
GlobalRequestFuture(String request)
Creates a new
GlobalRequestFuture for a global request. |
GlobalRequestFuture(String request,
GlobalRequestFuture.ReplyHandler handler)
Creates a new
GlobalRequestFuture for a global request. |
Modifier and Type | Method and Description |
---|---|
void |
fail(String message)
Fulfills this future, marking it as failed.
|
Buffer |
getBuffer()
Obtains the reply
Buffer if the request was successful. |
Throwable |
getException()
Retrieves an exception if the request failed.
|
GlobalRequestFuture.ReplyHandler |
getHandler()
Retrieves the
GlobalRequestFuture.ReplyHandler of this future, if any. |
String |
getId() |
long |
getSequenceNumber()
Retrieves this future's packet sequence number.
|
void |
operationComplete(IoWriteFuture future)
Invoked when the operation associated with the
SshFuture has been completed even if you add the listener
after the completion. |
void |
setSequenceNumber(long number)
Sets the packet sequence number of the global request represented by this future.
|
String |
toString() |
addListener, await0, cancel, getNumRegisteredListeners, getValue, isCanceled, isDone, notifyListeners, removeListener, setValue
asListener, asT, await, awaitUninterruptibly, formatExceptionMessage, notifyListener, verifyResult
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
validateListener
await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly
public GlobalRequestFuture(String request)
GlobalRequestFuture
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.request
- the request identifierpublic GlobalRequestFuture(String request, GlobalRequestFuture.ReplyHandler handler)
GlobalRequestFuture
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 with want-reply = false
, the
handler will be invoked with an empty buffer if the request was successfully sent.request
- the request identifierhandler
- the GlobalRequestFuture.ReplyHandler
, or null
public String getId()
getId
in interface WaitableFuture
getId
in class AbstractSshFuture<GlobalRequestFuture>
toString()
valuepublic long getSequenceNumber()
public void setSequenceNumber(long number)
number
- the packet sequence numberIllegalArgumentException
- if the number given is not an unsigned 32bit valuepublic void fail(String message)
message
- An explanation of the failure reasonpublic GlobalRequestFuture.ReplyHandler getHandler()
GlobalRequestFuture.ReplyHandler
of this future, if any.null
if none was setpublic Buffer getBuffer()
Buffer
if the request was successful. If called after DefaultSshFuture.isDone()
is
true
, a non-null
result means the request was successful.Buffer
, or null
if the request was not successful or the reply was not received yetpublic Throwable getException()
DefaultSshFuture.isDone()
is true
, a
null
result means the request did not fail.null
if there isn't one or if the request did not failpublic void operationComplete(IoWriteFuture future)
SshFutureListener
SshFuture
has been completed even if you add the listener
after the completion.operationComplete
in interface SshFutureListener<IoWriteFuture>
future
- The source SshFuture
which called this callback.public String toString()
toString
in class DefaultSshFuture<GlobalRequestFuture>
Copyright © 2008–2024 The Apache Software Foundation. All rights reserved.