class cMsgConnectionHandler
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
(package private) java.util.concurrent.ConcurrentHashMap<java.lang.Integer,org.jlab.coda.cMsg.cMsgDomain.server.cMsgConnectionHandler.clientInfoStorage> |
clients
Map in which to store the clients currently trying to connect and their associated info.
|
(package private) int |
debug
Debug level.
|
(package private) boolean |
killThisThread
Kill this thread if true.
|
(package private) cMsgNameServer |
nameServer
Name server object.
|
Constructor and Description |
---|
cMsgConnectionHandler(cMsgNameServer nameServer,
int debug)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
allowConnections(cMsgClientData info)
This method allows 2 connections from a client to begin.
|
void |
cleanupConnections(org.jlab.coda.cMsg.cMsgDomain.server.cMsgConnectionHandler.clientInfoStorage storage)
Cleanup debris when connections are not made, partially made,
or
gotConnections(org.jlab.coda.cMsg.cMsgDomain.server.cMsgClientData, int) has timed out. |
int |
getUniqueKey()
Get a unique key to use as client identification which is used
in forming the 2 permanent client connections using this object.
|
boolean |
gotConnections(cMsgClientData info,
int secondsToWait)
This method determines whether or not 2 connections from a client were made
after the process was initialized by the method
allowConnections(org.jlab.coda.cMsg.cMsgDomain.server.cMsgClientData) . |
(package private) void |
killThread()
Kills this thread.
|
void |
run()
This method is a thread which listens for TCP connections from the client.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
java.util.concurrent.ConcurrentHashMap<java.lang.Integer,org.jlab.coda.cMsg.cMsgDomain.server.cMsgConnectionHandler.clientInfoStorage> clients
cMsgNameServer nameServer
volatile boolean killThisThread
int debug
public cMsgConnectionHandler(cMsgNameServer nameServer, int debug)
nameServer
- server which contains this object.debug
- debug level which controls debugging output.void killThread()
public int getUniqueKey()
public void allowConnections(cMsgClientData info)
gotConnections(org.jlab.coda.cMsg.cMsgDomain.server.cMsgClientData, int)
which notifies
caller that connections were made or timeout occurred.Be sure to call this method before sending the name server response to the the initial client communication.
info
- client info objectpublic boolean gotConnections(cMsgClientData info, int secondsToWait)
allowConnections(org.jlab.coda.cMsg.cMsgDomain.server.cMsgClientData)
.
This method returns when the connections are complete or after the timeout period
(whichever is sooner).Be sure to call this method after finishing the name server response to the initial client communication.
info
- client info objectsecondsToWait
- number of seconds to wait for connections to be made before returning falsetrue
if connections made, else false
public void cleanupConnections(org.jlab.coda.cMsg.cMsgDomain.server.cMsgConnectionHandler.clientInfoStorage storage)
gotConnections(org.jlab.coda.cMsg.cMsgDomain.server.cMsgClientData, int)
has timed out.storage
- object storing client infopublic void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread