|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
uk.org.iscream.cms.conient.ConnectionHandler
This is the main thread for the client. Once started i continually checks it actionQueue for actions that other areas of the system have placed there, it then performs those actions. Currently this is the main thread where all non-GUI events are dispatched to.
Field Summary | |
private Queue |
_actionQueue
The queue that actions are added to by other parts of the system |
private Configuration |
_configuration
A reference to the system configuration component |
private String |
_configuredServer
The server that the config says we should connect to |
private TunnelProcess |
_controlFirewallProcess
The process used to start the firewall pipe for the control link. |
private Socket |
_controlLink
The control link socket |
private DataPanel |
_data
A reference to the displaying class DataPanel |
private TunnelProcess |
_dataFirewallProcess
The process used to start the firewall pipe for the data link. |
private BufferedReader |
_dataInBound
The input for the data link |
private Socket |
_dataLink
The data link socket |
private PrintWriter |
_dataOutBound
The output for the data link |
private DataReader |
_dataReader
A reference to the DataReader in use |
private BufferedReader |
_inBound
The input for the control link |
private int |
_myQueue
The queue number that we are reading from on the action queue |
private PrintWriter |
_outBound
The output for the control link |
private boolean |
_running
The state if this thread |
private String |
_server
The server we will be connecting to |
static int |
CONNECT
Thread action CONNECT. |
static int |
DATAREADER_SHUTDOWN_TIMEOUT
This is the time in seconds that this class should wait on the DataReader class to fully shutdown after calling shutdown() before forcing a shutdown |
static int |
DEFAULT_FIREWALL_COMMANDWAIT
The default time in seconds to wait for the firewall setup command to execute |
static String |
DEFAULT_FIREWALL_SERVER
The default local server to connect to when a firewall is in use if one is not specified in the server |
static int |
DEFAULT_QUEUE_LIMIT
The default maximum queue size in use for the data queue |
static int |
DISCONNECT
Thread action DISCONNECT. |
static int |
DONOTHING
Thread action DONOTHING. |
static int |
GETCONFIGURATION
Thread action GETCONFIGURATION Starts the command to obtain the configuration from the server. |
double |
PROTOCOL_VERSION
The hardcoded protocol version that we are using. |
static int |
QUEUE_ALGORITHM
The algorithm we use to remove items from the queue if it reaches its maximum size. |
static int |
QUIT
Thread action QUIT. |
String |
REVISION
The current CVS revision of this class |
static int |
STARTDATA
Thread action STARTDATA. |
static int |
STOPDATA
Thread action STOPDATA. |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
ConnectionHandler(DataPanel data,
Queue actionQueue)
Constructs new data handler. |
Method Summary | |
private void |
closeFirewall(TunnelProcess firewallProcess)
Checks to see if the given firewall process has been created. |
String |
getConfigFromServer(String configName,
String propertyName)
This method is called by the Configuration object when a request is made for a server property. |
private String |
handleFirewall(String server,
int port,
TunnelProcess firewallProcess)
Handles opening pipes through firewalls. |
void |
run()
Starts this ConnectionHandler running. |
private boolean |
setHostList(String hostList)
This method performs the SETHOSTLIST command. |
void |
shutdown()
This method allows other classes to shutdown this connection handler. |
void |
shutdownDataLink()
Called by the DataReader if the link is unexpectedly lost. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public final String REVISION
public final double PROTOCOL_VERSION
public static final int DONOTHING
public static final int CONNECT
public static final int STARTDATA
public static final int STOPDATA
public static final int DISCONNECT
public static final int QUIT
public static final int GETCONFIGURATION
public static final int DATAREADER_SHUTDOWN_TIMEOUT
public static final String DEFAULT_FIREWALL_SERVER
public static final int DEFAULT_FIREWALL_COMMANDWAIT
public static final int DEFAULT_QUEUE_LIMIT
public static final int QUEUE_ALGORITHM
private boolean _running
private DataPanel _data
private Queue _actionQueue
private int _myQueue
private Socket _controlLink
private Socket _dataLink
private BufferedReader _inBound
private PrintWriter _outBound
private BufferedReader _dataInBound
private PrintWriter _dataOutBound
private DataReader _dataReader
private Configuration _configuration
private String _server
private String _configuredServer
private TunnelProcess _controlFirewallProcess
private TunnelProcess _dataFirewallProcess
Constructor Detail |
public ConnectionHandler(DataPanel data, Queue actionQueue)
data
- the DataPanel in useactionQueue
- the actionQueue for this classMethod Detail |
public void run()
public String getConfigFromServer(String configName, String propertyName)
public void shutdown()
public void shutdownDataLink()
private boolean setHostList(String hostList)
hostList
- the list of hosts as gained from the config
private String handleFirewall(String server, int port, TunnelProcess firewallProcess)
server
- the name of the server to open up the pipe toport
- the port number to open up the pipe tofirewallProcess
- the holder for the new firewall process
private void closeFirewall(TunnelProcess firewallProcess)
firewallProcess
- the process to check
|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |