Package org.apache.guacamole.protocol
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 Summary
Constructors Constructor Description FailoverGuacamoleSocket(GuacamoleSocket socket)
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.FailoverGuacamoleSocket(GuacamoleSocket socket, int instructionQueueLimit)
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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GuacamoleReader
getReader()
Returns a GuacamoleReader which can be used to read from the Guacamole instruction stream associated with the connection represented by this GuacamoleSocket.-
Methods inherited from class org.apache.guacamole.net.DelegatingGuacamoleSocket
close, getDelegateSocket, getProtocol, getWriter, isOpen
-
-
-
-
Constructor Detail
-
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 Detail
-
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 interfaceGuacamoleSocket
- Overrides:
getReader
in classDelegatingGuacamoleSocket
- Returns:
- A GuacamoleReader which can be used to read from the Guacamole instruction stream.
-
-