lime
Class OutgoingMgr

java.lang.Object
  extended bylime.OutgoingMgr
All Implemented Interfaces:
java.lang.Runnable

class OutgoingMgr
extends java.lang.Object
implements java.lang.Runnable

Handles outgoing communication (unicast and groupcast) with remote hosts for operations and transactions.

Version:
1/6/2003
Author:
Amy L. Murphy, Gian Pietro Picco, Chien-Liang Fok

Field Summary
private  ConnectionMgr cmgr
          A reference to the connection manager.
private  LimeServer limeServer
          A reference to the LIMEServer singleton.
private  Queue outgoing
          Holds RemoteOpDescriptor objects that are to be sent to other hosts.
(package private) static int OUTGOING_QUEUE
          The index of the outgoing queue within the outgoing queue mux.
(package private) static int OUTGOING_TRANSACTION_QUEUE
          The index of the outgoing transactions queue within the outgoing queue mux.
private static OutgoingMgr outgoingMgr
          Creates the OutgoingMgr.
private  QueueMux outgoingQueues
          A Mux that determines from which queue the outgoingMgr should take and send TransactionOpDescriptors from.
private  Queue outgoingTransactions
          A queue that contains the TransactionOpDescriptors that should be sent to another host.
private  TransactionMgr transMgr
          A reference to the Transaction Manager.
 
Constructor Summary
private OutgoingMgr()
          OutgoingMgr is a singleton.
 
Method Summary
 void flushOutgoingQueue()
          Blocks until the current outgoing queue is empty.
(package private) static OutgoingMgr getOutgoingMgr()
          Provides a reference to the OutgoingMgr singleton.
 java.util.Enumeration normElements()
          Returns an enumeration of the elements within the normal outgoing queue.
 void removeNorm(RemoteOpDescriptor desc)
          Removes the specified RemoteOpDsecriptor from the outgoing queue.
 void run()
          Sits in a loop monitoring the outgoingQueues looking for messages to send and sending them.
 void send(RemoteOpDescriptor desc)
          Adds a RemoteOpDescriptor to the current outgoing queue.
 void send(java.util.Vector buff, LimeServerID dest)
          Sends the objects stored in vector tmp to the specified LIMEServer.
private  void sendAllHosts(TransactionOpDescriptor desc)
          Sends a message to everyone within the group regardless of whether they have a tuple space shared.
private  void sendGroupcast(TSOpDescriptor desc)
          Sends a message to all hosts in the group with at least one tuple space shared.
 void sendNorm(RemoteOpDescriptor desc)
          Adds a RemoteOpDescriptor to the outgoing queue.
 void sendTrans(RemoteOpDescriptor desc)
          Sends a RemoteOpDescriptor via the transaction queue.
 void setOutgoingQueue(int qChoice)
          Sets the active queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OUTGOING_QUEUE

static final int OUTGOING_QUEUE
The index of the outgoing queue within the outgoing queue mux.

See Also:
Constant Field Values

OUTGOING_TRANSACTION_QUEUE

static final int OUTGOING_TRANSACTION_QUEUE
The index of the outgoing transactions queue within the outgoing queue mux.

See Also:
Constant Field Values

limeServer

private LimeServer limeServer
A reference to the LIMEServer singleton.


transMgr

private TransactionMgr transMgr
A reference to the Transaction Manager.


outgoingMgr

private static final OutgoingMgr outgoingMgr
Creates the OutgoingMgr.


cmgr

private ConnectionMgr cmgr
A reference to the connection manager.


outgoing

private Queue outgoing
Holds RemoteOpDescriptor objects that are to be sent to other hosts.


outgoingTransactions

private Queue outgoingTransactions
A queue that contains the TransactionOpDescriptors that should be sent to another host.


outgoingQueues

private QueueMux outgoingQueues
A Mux that determines from which queue the outgoingMgr should take and send TransactionOpDescriptors from.

Constructor Detail

OutgoingMgr

private OutgoingMgr()
OutgoingMgr is a singleton.

Method Detail

send

public void send(RemoteOpDescriptor desc)
Adds a RemoteOpDescriptor to the current outgoing queue. This queue may be the normalOpQueue or the transactions queue.


removeNorm

public void removeNorm(RemoteOpDescriptor desc)
Removes the specified RemoteOpDsecriptor from the outgoing queue.


sendNorm

public void sendNorm(RemoteOpDescriptor desc)
Adds a RemoteOpDescriptor to the outgoing queue.


normElements

public java.util.Enumeration normElements()
Returns an enumeration of the elements within the normal outgoing queue.


sendTrans

public void sendTrans(RemoteOpDescriptor desc)
Sends a RemoteOpDescriptor via the transaction queue.


flushOutgoingQueue

public void flushOutgoingQueue()
Blocks until the current outgoing queue is empty.


setOutgoingQueue

public void setOutgoingQueue(int qChoice)
Sets the active queue. Possible options include OutgoingMgr.OUTGOING_QUEUE and OutgoingMgr.OUTGOING_TRANSACTION_QUEUE.


getOutgoingMgr

static OutgoingMgr getOutgoingMgr()
Provides a reference to the OutgoingMgr singleton.


run

public void run()
Sits in a loop monitoring the outgoingQueues looking for messages to send and sending them.

Specified by:
run in interface java.lang.Runnable

sendAllHosts

private void sendAllHosts(TransactionOpDescriptor desc)
Sends a message to everyone within the group regardless of whether they have a tuple space shared.


sendGroupcast

private void sendGroupcast(TSOpDescriptor desc)
Sends a message to all hosts in the group with at least one tuple space shared. Does not send the message to the local host.


send

public void send(java.util.Vector buff,
                 LimeServerID dest)
Sends the objects stored in vector tmp to the specified LIMEServer. This actually sends the message, it does not enqueue the message.