Class FailoverGuacamoleSocket

java.lang.Object
org.apache.guacamole.net.DelegatingGuacamoleSocket
org.apache.guacamole.protocol.FailoverGuacamoleSocket
All Implemented Interfaces:
GuacamoleSocket

public class FailoverGuacamoleSocket extends DelegatingGuacamoleSocket
GuacamoleSocket which intercepts errors received early in the Guacamole session. Upstream errors which are intercepted early enough result in exceptions thrown immediately within the FailoverGuacamoleSocket's constructor, allowing a different socket to be substituted prior to fulfilling the connection.
  • Constructor Details

    • FailoverGuacamoleSocket

      public FailoverGuacamoleSocket(GuacamoleSocket socket, int instructionQueueLimit) throws GuacamoleException, GuacamoleUpstreamException
      Creates a new FailoverGuacamoleSocket which reads Guacamole instructions from the given socket, searching for errors from the upstream remote desktop until the given instruction queue limit is reached. If an upstream error is encountered, it is thrown as a GuacamoleUpstreamException. This constructor will block until an error is encountered, until insufficient space remains in the instruction queue, or until the connection appears to have been successful. Once the FailoverGuacamoleSocket has been created, all reads, writes, etc. will be delegated to the provided socket.
      Parameters:
      socket - The GuacamoleSocket of the Guacamole connection this FailoverGuacamoleSocket should handle.
      instructionQueueLimit - The maximum number of characters of Guacamole instruction data to store within the instruction queue while searching for errors. Once this limit is exceeded, the connection is assumed to be successful.
      Throws:
      GuacamoleException - If an error occurs while reading data from the provided socket.
      GuacamoleUpstreamException - If the connection to guacd succeeded, but an error occurred while connecting to the remote desktop.
    • FailoverGuacamoleSocket

      public FailoverGuacamoleSocket(GuacamoleSocket socket) throws GuacamoleException, GuacamoleUpstreamException
      Creates a new FailoverGuacamoleSocket which reads Guacamole instructions from the given socket, searching for errors from the upstream remote desktop until a maximum of 128KB of instruction data has been queued. If an upstream error is encountered, it is thrown as a GuacamoleUpstreamException. This constructor will block until an error is encountered, until insufficient space remains in the instruction queue, or until the connection appears to have been successful. Once the FailoverGuacamoleSocket has been created, all reads, writes, etc. will be delegated to the provided socket.
      Parameters:
      socket - The GuacamoleSocket of the Guacamole connection this FailoverGuacamoleSocket should handle.
      Throws:
      GuacamoleException - If an error occurs while reading data from the provided socket.
      GuacamoleUpstreamException - If the connection to guacd succeeded, but an error occurred while connecting to the remote desktop.
  • Method Details

    • getReader

      public GuacamoleReader getReader()
      Description copied from interface: GuacamoleSocket
      Returns a GuacamoleReader which can be used to read from the Guacamole instruction stream associated with the connection represented by this GuacamoleSocket.
      Specified by:
      getReader in interface GuacamoleSocket
      Overrides:
      getReader in class DelegatingGuacamoleSocket
      Returns:
      A GuacamoleReader which can be used to read from the Guacamole instruction stream.