|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.epfl.lsr.apex.connection.APEXConnectionThread
An APEXConnectionThread
is a connection thread either
initiates a new connection or works on a extisting one.
It takes messages from its owner (APEXConnection, say mesh or edge connection) and sends these messages.
The state machine of the connection thread:
If a channel is not yet opened:
Repeating:
To close a connection:
APEXConnection
,
APEXMeshConnection
,
APEXEdgeConnection
Field Summary | |
static int |
CHANNEL_CLOSING
internal state: closing channel |
static int |
CHANNEL_ESTABLISHMENT
internal state: establishing channel |
static int |
IDLE
internal state: idle |
static int |
INIT
internal state: initiation |
static int |
MESSAGE_TRANSFER
internal state: transfering fetched message |
static int |
REPLY_LISTENER
internal state: fetching reply (starting reply listener) |
static int |
SESSION_CLOSING
internal state: closing session |
static int |
SESSION_ESTABLISHMENT
internal state: establishing session |
static int |
WAIT_FOR_MESSAGES
internal state: waiting for messages |
static int |
WAIT_FOR_TASK
internal state: waiting for a new task |
Constructor Summary | |
APEXConnectionThread(APEXConnection connection,
APEXManager manager,
String domain,
Channel channel)
Instantiate a new APEXConnectionThread for a connection
opened by another hop (session and channel establishment becomes
unnecessary). |
|
APEXConnectionThread(APEXConnection connection,
APEXManager manager,
String domain,
int port,
APEXProfile messageListener)
Instantiates a new APEXConnectionThread which first
establishes the session and channel. |
Method Summary | |
Channel |
getChannel()
Returns the open(ed) channel for this thread. |
void |
run()
The state machine of the connection thread: If a channel is not yet opened: establish session open channel Repeating: wait for a new message to send send this message start a reply listener for the reply reference To close a connection: close channel close connection |
void |
setTask(int t)
Sets the state of the thread |
void |
stopRun()
Stopps the connection thread on the next turn. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int INIT
public static final int IDLE
public static final int WAIT_FOR_MESSAGES
public static final int SESSION_ESTABLISHMENT
public static final int CHANNEL_ESTABLISHMENT
public static final int MESSAGE_TRANSFER
public static final int REPLY_LISTENER
public static final int CHANNEL_CLOSING
public static final int SESSION_CLOSING
public static final int WAIT_FOR_TASK
Constructor Detail |
public APEXConnectionThread(APEXConnection connection, APEXManager manager, String domain, int port, APEXProfile messageListener)
APEXConnectionThread
which first
establishes the session and channel.
connection
- The initiating connectionmanager
- The managerdomain
- The domain literal to connect toport
- The port number to connect tomessageListener
- The message listener for the connection (the profile)public APEXConnectionThread(APEXConnection connection, APEXManager manager, String domain, Channel channel)
APEXConnectionThread
for a connection
opened by another hop (session and channel establishment becomes
unnecessary).
connection
- The initiating connectionmanager
- The managerdomain
- The domain literal connected tochannel
- The channel opened by the opposite hopMethod Detail |
public void setTask(int t)
t
- The statepublic void stopRun()
public Channel getChannel()
public void run()
The state machine of the connection thread:
If a channel is not yet opened:
Repeating:
To close a connection:
run
in interface Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |