Package org.apache.guacamole.net
Class AbstractGuacamoleTunnel
java.lang.Object
org.apache.guacamole.net.AbstractGuacamoleTunnel
- All Implemented Interfaces:
GuacamoleTunnel
- Direct Known Subclasses:
SimpleGuacamoleTunnel
Base GuacamoleTunnel implementation which synchronizes access to the
underlying reader and writer with reentrant locks. Implementations need only
provide the tunnel's UUID and socket.
-
Field Summary
Fields inherited from interface org.apache.guacamole.net.GuacamoleTunnel
INTERNAL_DATA_OPCODE
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new GuacamoleTunnel which synchronizes access to the Guacamole instruction stream associated with the underlying GuacamoleSocket. -
Method Summary
Modifier and TypeMethodDescriptionAcquires exclusive read access to the Guacamole instruction stream and returns a GuacamoleReader for reading from that stream.Acquires exclusive write access to the Guacamole instruction stream and returns a GuacamoleWriter for writing to that stream.void
close()
Release all resources allocated to this GuacamoleTunnel.boolean
Returns whether there are threads waiting for read access to the Guacamole instruction stream.boolean
Returns whether there are threads waiting for write access to the Guacamole instruction stream.boolean
isOpen()
Returns whether this GuacamoleTunnel is open, or has been closed.void
Relinquishes exclusive read access to the Guacamole instruction stream.void
Relinquishes exclusive write access to the Guacamole instruction stream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.guacamole.net.GuacamoleTunnel
getSocket, getUUID
-
Constructor Details
-
AbstractGuacamoleTunnel
public AbstractGuacamoleTunnel()Creates a new GuacamoleTunnel which synchronizes access to the Guacamole instruction stream associated with the underlying GuacamoleSocket.
-
-
Method Details
-
acquireReader
Acquires exclusive read access to the Guacamole instruction stream and returns a GuacamoleReader for reading from that stream.- Specified by:
acquireReader
in interfaceGuacamoleTunnel
- Returns:
- A GuacamoleReader for reading from the Guacamole instruction stream.
-
releaseReader
public void releaseReader()Relinquishes exclusive read access to the Guacamole instruction stream. This function should be called whenever a thread finishes using a GuacamoleTunnel's GuacamoleReader.- Specified by:
releaseReader
in interfaceGuacamoleTunnel
-
hasQueuedReaderThreads
public boolean hasQueuedReaderThreads()Returns whether there are threads waiting for read access to the Guacamole instruction stream.- Specified by:
hasQueuedReaderThreads
in interfaceGuacamoleTunnel
- Returns:
- true if threads are waiting for read access the Guacamole instruction stream, false otherwise.
-
acquireWriter
Acquires exclusive write access to the Guacamole instruction stream and returns a GuacamoleWriter for writing to that stream.- Specified by:
acquireWriter
in interfaceGuacamoleTunnel
- Returns:
- A GuacamoleWriter for writing to the Guacamole instruction stream.
-
releaseWriter
public void releaseWriter()Relinquishes exclusive write access to the Guacamole instruction stream. This function should be called whenever a thread finishes using a GuacamoleTunnel's GuacamoleWriter.- Specified by:
releaseWriter
in interfaceGuacamoleTunnel
-
hasQueuedWriterThreads
public boolean hasQueuedWriterThreads()Description copied from interface:GuacamoleTunnel
Returns whether there are threads waiting for write access to the Guacamole instruction stream.- Specified by:
hasQueuedWriterThreads
in interfaceGuacamoleTunnel
- Returns:
- true if threads are waiting for write access the Guacamole instruction stream, false otherwise.
-
close
Description copied from interface:GuacamoleTunnel
Release all resources allocated to this GuacamoleTunnel.- Specified by:
close
in interfaceGuacamoleTunnel
- Throws:
GuacamoleException
- if an error occurs while releasing resources.
-
isOpen
public boolean isOpen()Description copied from interface:GuacamoleTunnel
Returns whether this GuacamoleTunnel is open, or has been closed.- Specified by:
isOpen
in interfaceGuacamoleTunnel
- Returns:
- true if this GuacamoleTunnel is open, false if it is closed.
-