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, org.apache.sshd.common.future.HasException, org.apache.sshd.common.future.SshFuture<GlobalRequestFuture>, org.apache.sshd.common.future.SshFutureListener<org.apache.sshd.common.io.IoWriteFuture>, org.apache.sshd.common.future.WaitableFuture, org.apache.sshd.common.util.SshdEventListener

public class GlobalRequestFuture extends org.apache.sshd.common.future.DefaultSshFuture<GlobalRequestFuture> implements org.apache.sshd.common.future.HasException, org.apache.sshd.common.future.SshFutureListener<org.apache.sshd.common.io.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 Classes
    Modifier and Type
    Class
    Description
    static interface 
    A ReplyHandler is invoked asynchronously when the reply for a request with want-reply = true is received.
  • Field Summary

    Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean

    log
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new GlobalRequestFuture for a global request.
    Creates a new GlobalRequestFuture for a global request.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.sshd.common.util.buffer.Buffer
    Obtains the reply Buffer if the request was successful.
    Retrieves an exception if the request failed.
    Retrieves the GlobalRequestFuture.ReplyHandler of this future, if any.
     
    long
    Retrieves this future's packet sequence number.
    void
    operationComplete(org.apache.sshd.common.io.IoWriteFuture future)
     
    void
    setSequenceNumber(long number)
    Sets the packet sequence number of the global request represented by this future.
     

    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 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

      public GlobalRequestFuture(String request)
      Creates a new 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.
      Parameters:
      request - the request identifier
    • GlobalRequestFuture

      public GlobalRequestFuture(String request, GlobalRequestFuture.ReplyHandler handler)
      Creates a new 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.
      Parameters:
      request - the request identifier
      handler - the GlobalRequestFuture.ReplyHandler, or null
  • Method Details

    • getId

      public String getId()
      Specified by:
      getId in interface org.apache.sshd.common.future.WaitableFuture
      Overrides:
      getId in class org.apache.sshd.common.future.AbstractSshFuture<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

      public GlobalRequestFuture.ReplyHandler getHandler()
      Retrieves the GlobalRequestFuture.ReplyHandler of this future, if any.
      Returns:
      the handler, or null if none was set
    • getBuffer

      public org.apache.sshd.common.util.buffer.Buffer getBuffer()
      Obtains the reply Buffer if the request was successful. If called after DefaultSshFuture.isDone() is true, a non-null result means the request was successful.
      Returns:
      the Buffer, or null if the request was not successful or the reply was not received yet
    • getException

      public Throwable getException()
      Retrieves an exception if the request failed. If called after DefaultSshFuture.isDone() is true, a null result means the request did not fail.
      Specified by:
      getException in interface org.apache.sshd.common.future.HasException
      Returns:
      a failure reason, or null if there isn't one or if the request did not fail
    • operationComplete

      public void operationComplete(org.apache.sshd.common.io.IoWriteFuture future)
      Specified by:
      operationComplete in interface org.apache.sshd.common.future.SshFutureListener<org.apache.sshd.common.io.IoWriteFuture>
    • toString

      public String toString()
      Overrides:
      toString in class org.apache.sshd.common.future.DefaultSshFuture<GlobalRequestFuture>