|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
NetAcctClient.ConnectionMgr
Basically, this class keeps track of the connection to the NetAcctServer and trys to ensure that it is always connected. In order to accomplish this, the class will check to see if the socket is connected every CHECK_WAIT_TIME seconds. If it is not connected, then it tries to connect it, waiting RECONNECT_WAIT_TIME seconds between retries.
| Field Summary | |
static int |
CHECK_WAIT_TIME
This is the amount of time (in seconds) to wait between checks. |
private byte[] |
nop
The string to write as the 'no operation' operation command. |
static int |
RECONNECT_WAIT_TIME
This is the amount of time (in seconds) to wait between reconnection attempts. |
(package private) OutputStream |
testOut
|
private boolean |
wasConnected
Used to keep track of whether or not the client was connected. |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
NetAcctClient.ConnectionMgr()
Initialize the ConnectionMgr class by getting a reference to the sockets OutputStream, then initializing the 'nop' variable that is used to send pings to the account server. |
|
| Method Summary | |
boolean |
isConnected()
Determines if the socket is connected or not. |
void |
reconnect()
Attempts to reconnect the accounting client to the server, waiting RECONNECT_WAIT_TIME seconds between attempts. |
void |
run()
Loops forever checking that the client is connected. |
| 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 |
OutputStream testOut
public static final int CHECK_WAIT_TIME
public static final int RECONNECT_WAIT_TIME
private byte[] nop
private boolean wasConnected
| Constructor Detail |
public NetAcctClient.ConnectionMgr()
| Method Detail |
public void run()
public boolean isConnected()
public void reconnect()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||