class cMsgClientListeningThread
extends java.lang.Thread
This class implements a cMsg client's thread which listens for communications from the domain server. The server sends it keep alives, messages to which the client has subscribed, and other directives.
Note that the class org.jlab.cMsg.RCDomain.rcListeningThread is largely the same as this one. If there are any changes made here the identical changes should be made there as well.
Modifier and Type | Field and Description |
---|---|
(package private) byte[] |
bytes
Allocate byte array once (used for reading in data) for efficiency's sake.
|
(package private) java.io.DataInputStream |
in
Socket input stream associated with channel.
|
Constructor and Description |
---|
cMsgClientListeningThread(cMsgServerClient myClient,
java.net.Socket sock)
Constructor for server clients.
|
cMsgClientListeningThread(cMsg myClient,
java.net.Socket sock)
Constructor for regular clients.
|
Modifier and Type | Method and Description |
---|---|
void |
changeSockets(java.net.Socket sock)
If reconnecting to another server as part of a failover, we must change to
another channel.
|
void |
killThread()
Kills this thread.
|
void |
run()
This method is executed as a thread.
|
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.io.DataInputStream in
byte[] bytes
public cMsgClientListeningThread(cMsg myClient, java.net.Socket sock) throws java.io.IOException
myClient
- cMsg client that created this objectsock
- main communication socket with serverjava.io.IOException
- if an I/O error occurs when creating the
input stream, the socket is closed, the socket is
not connected, or the socket input has been shutdown.public cMsgClientListeningThread(cMsgServerClient myClient, java.net.Socket sock) throws java.io.IOException
myClient
- cMsg server client that created this objectsock
- main communication socket with serverjava.io.IOException
- if an I/O error occurs when creating the
input stream, the socket is closed, the socket is
not connected, or the socket input has been shutdown.public void killThread()
public void changeSockets(java.net.Socket sock) throws java.io.IOException
sock
- main communication socket with serverjava.io.IOException
- if channel is closedpublic void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread