|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.epfl.lsr.apex.connection.APEXConnection
An APEXConnection
is a connection thread that takes
messages to send on this connection in a linked list (file) and
sends them on after another to the destination.
The APEXConnection, due to its abstract property, must be redefined as either an APEXMeshConnection for relay-relay connections or an APEXEdgeConnection for relay-endpoint connections.
APEXMeshConnection
,
APEXEdgeConnection
Field Summary | |
protected Hashtable |
authenticatedAs
A table of authenticated names of this entity on this connection |
static int |
CHANNEL_ESTABLISHED
|
protected Object |
channelID
A unique channel identifier for this connection |
static int |
CONNECTION_INITIATION
|
protected boolean |
connectionEstablished
indicates the state of the connection |
protected APEXConnectionThread |
connectionThread
The actual connection runs in a connection thread for this connection |
protected static Hashtable |
currentConnections
A static table for all currently running connections. |
protected String |
entity
The general entity name for this connection (relay or endpoint name) |
protected Hashtable |
internalIDs
A table of internal identifiers to map back attached endpoints or bound relays to correspondent transaction identifiers |
protected static Hashtable |
knownChannels
A static table for already known channels to link different attaching endpoints or relays (for a relay) and different domains (for an endpoint) on the same connection. |
protected APEXManager |
manager
The associated manager for call-backs |
protected LinkedList |
messageFile
A message file (channel) FIFO |
protected long |
pollingIntervall
The polling interval for connection control: 10 sec |
protected APEXProfile |
profile
The profile associated to this connection |
protected boolean |
running
indicates the state thread |
protected int |
task
the state of the connection |
protected Integer |
transID
The transaction identifier counter for this connection |
protected int |
trialNb
Attempt counter on reconnection |
Constructor Summary | |
APEXConnection()
|
Method Summary | |
protected void |
addFirstMessage(APEXMessage m)
Adds a message to the first position of the FIFO message file. |
protected void |
addMessage(APEXMessage m)
Adds a message to the FIFO message file. |
protected abstract void |
channelEstablished()
Is called by the connection thread if an APEX channel is successfully established - allows to update the status of the connection. |
protected void |
clearMessageFile()
Flushes the whole message file irrevocable. |
Object |
getChannelID()
Returns the channel identifier associated to this connection. |
protected APEXMessage |
getMessage()
Blocking method which is called by the connection thread in order to get a new message to send. |
int |
getUniqueTransID()
Returns a unique transaction identifier for this connection. |
protected abstract void |
handleReply(Message replyMessage,
APEXMessage message)
Handles a received reply message to a correspondent (sent) APEX message (attach, bind, terminate, or data). |
protected abstract boolean |
isAuthenticated(APEXDataMessage message)
Returns a boolean which depends if the message is authentcated to be sent or not to the hop (either attached or bound). |
protected abstract void |
messageNotSent(APEXMessage message)
Is called by the connection thread if the session is down an the message has not been sent. |
protected void |
newAttachmentOrBinding()
Is called on a new attachment or binding in order to release blocked connection threads in the getMessage table.
|
protected abstract void |
noConnectionEstablished()
Is called by the connection thread if no connection is established and initiates correspondent actions (according the connection type and the underlying manager). |
protected abstract void |
requestedChannelNotStarted()
Is called by the connection thread if no APEX channel is established and initiates correspondent actions (according the connection type and the underlying manager). |
void |
updateTransID(int aTransID)
Updates the internal transID counter if the opposite hop used a new transaction identifier. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Runnable |
run |
Field Detail |
public static final int CONNECTION_INITIATION
public static final int CHANNEL_ESTABLISHED
protected static Hashtable currentConnections
A static table for all currently running connections.
A connection is mapped with the domain part of its opposite entity.
protected static Hashtable knownChannels
A static table for already known channels to link different attaching endpoints or relays (for a relay) and different domains (for an endpoint) on the same connection.
protected int trialNb
protected boolean running
protected int task
protected APEXManager manager
protected Hashtable authenticatedAs
protected LinkedList messageFile
protected APEXConnectionThread connectionThread
protected String entity
protected APEXProfile profile
protected Hashtable internalIDs
protected Object channelID
protected boolean connectionEstablished
protected long pollingIntervall
protected Integer transID
Constructor Detail |
public APEXConnection()
Method Detail |
protected abstract void handleReply(Message replyMessage, APEXMessage message)
replyMessage
- The received reply messagemessage
- The sent APEX messageprotected abstract void messageNotSent(APEXMessage message)
Is called by the connection thread if the session is down an the message has not been sent.
Dependent on the underlying manager and the connection type (edge or
mesh), this method either tries to reconnect or calls the discardMessage
method of its manager.
message
- The unsent messageprotected abstract void noConnectionEstablished()
protected abstract void requestedChannelNotStarted()
protected abstract void channelEstablished()
protected abstract boolean isAuthenticated(APEXDataMessage message)
public Object getChannelID()
public int getUniqueTransID()
public void updateTransID(int aTransID)
aTransID
- The transID used by the opposite hopprotected APEXMessage getMessage()
protected void addFirstMessage(APEXMessage m)
m
- The message to addprotected void addMessage(APEXMessage m)
m
- The message to addprotected void clearMessageFile()
protected void newAttachmentOrBinding()
getMessage
table.
(Note: a connection thread is blocked no message is authenticated
to be sent according the attach / bind status)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |