|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
org.openflow.gui.net.BackendConnection<MSG_TYPE>
public class BackendConnection<MSG_TYPE extends Message>
Connects to a server instance to receive stats and send commands.
| Nested Class Summary | |
|---|---|
class |
BackendConnection.NetStats
Statistics about this connection. |
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected java.util.concurrent.ConcurrentHashMap<java.lang.Integer,OFGMessage> |
outstandingStatefulPollRequests
stateful messages which are being polled by the backend for us |
protected java.util.concurrent.ConcurrentHashMap<java.lang.Integer,OFGMessage> |
outstandingStatefulRequests
messages which are expecting a stateful response |
static boolean |
PRINT_MESSAGES
whether to print messages we send and receive |
static int |
RETRY_WAIT_MSEC_MAX
maximum time to wait between tries to get connected |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
BackendConnection(MessageProcessor<MSG_TYPE> mp,
java.lang.String ip,
int port)
Connect to the server at the specified address and port. |
|
| Method Summary | |
|---|---|
boolean |
isConnected()
returns true if the connection to the server is currently alive |
boolean |
isShutdown()
gets whether the connection has been shutdown yet |
OFGMessage |
popAssociatedStatefulRequest(int xid)
Returns the request sent with the specified transaction ID, if any. |
void |
reconnect()
tells the connection to disconnect and then connect again |
void |
run()
The BackendConnection thread will connect to the server and then continuously read from the socket and pass on received messages to the protocol handler. |
protected void |
scrubExpiredStatefulRequests()
Remove cached stateful requests which have been cached for longer than getRequestLifetime() |
void |
sendMessage(OFGMessage m)
Tries to send a message and sets the transaction ID of the message to the next available transaction ID. |
void |
shutdown()
tells the connection to shut down as soon as possible |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, 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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final boolean PRINT_MESSAGES
public static final int RETRY_WAIT_MSEC_MAX
protected java.util.concurrent.ConcurrentHashMap<java.lang.Integer,OFGMessage> outstandingStatefulRequests
protected java.util.concurrent.ConcurrentHashMap<java.lang.Integer,OFGMessage> outstandingStatefulPollRequests
| Constructor Detail |
|---|
public BackendConnection(MessageProcessor<MSG_TYPE> mp,
java.lang.String ip,
int port)
ip - the IP where the server livesport - the port the server listens on| Method Detail |
|---|
public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void shutdown()
public boolean isShutdown()
public boolean isConnected()
public void reconnect()
public void sendMessage(OFGMessage m)
throws java.io.IOException
java.io.IOExceptionpublic OFGMessage popAssociatedStatefulRequest(int xid)
protected void scrubExpiredStatefulRequests()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||