fr.dyade.aaa.agent.MessageVector Class Reference

Inherits fr.dyade.aaa.agent.MessageQueue.

Inheritance diagram for fr.dyade.aaa.agent.MessageVector:

Inheritance graph
[legend]
Collaboration diagram for fr.dyade.aaa.agent.MessageVector:

Collaboration graph
[legend]
List of all members.

Public Member Functions

synchronized void insert (Message item)
synchronized void push (Message item)
synchronized Message pop () throws EmptyQueueException
synchronized void validate ()
synchronized Message get () throws InterruptedException
synchronized Message get (long timeout) throws InterruptedException
synchronized Message getMessageTo (short to)
int size ()
String toString ()

Package Functions

 MessageVector (String name, boolean persistent)
synchronized void removeMessage (Message msg)
synchronized int remove (int stamp)
synchronized Message removeExpired (long currentTimeMillis)
void insertMessageAt (Message item, int index)
void addMessage (Message item)
Message getMessageAt (int index)
void removeMessageAt (int index)

Classes

class  MessageSoftRef
class  TransactionError

Detailed Description

Class MessageVector represents a persistent vector of Message (source and target agent identifier, notification). As messages have a relatively short life span, then the messages are kept in main memory. If possible, the list is backed by a persistent image on the disk for reliability needs. In this case, we can use SoftReference to avoid memory overflow.


The stamp information in Message is used to restore the queue from persistent storage at initialization time, so there is no longer need to save MessageVector object state.

Definition at line 40 of file MessageVector.java.


Member Function Documentation

synchronized void fr.dyade.aaa.agent.MessageVector.insert ( Message  item  ) 

Insert a message in the queue, it should only be used during initialization for restoring the queue state.

Parameters:
item the message to be pushed onto this queue.

Implements fr.dyade.aaa.agent.MessageQueue.

Definition at line 84 of file MessageVector.java.

References fr.dyade.aaa.agent.MessageVector.getMessageAt(), fr.dyade.aaa.agent.Message.getStamp(), and fr.dyade.aaa.agent.MessageVector.insertMessageAt().

Referenced by fr.dyade.aaa.agent.Network.insert().

Here is the call graph for this function:

synchronized void fr.dyade.aaa.agent.MessageVector.push ( Message  item  ) 

Pushes a message onto the bottom of this queue. It should only be used during a transaction. The item will be really available after the transaction commit and the queue validate.

Parameters:
item the message to be pushed onto this queue.

Implements fr.dyade.aaa.agent.MessageQueue.

Definition at line 104 of file MessageVector.java.

References fr.dyade.aaa.agent.MessageVector.addMessage().

Referenced by fr.dyade.aaa.agent.Network.post().

Here is the call graph for this function:

synchronized Message fr.dyade.aaa.agent.MessageVector.pop (  )  throws EmptyQueueException

Removes the message at the top of this queue. It must only be used during a transaction.

Returns:
The message at the top of this queue.
Exceptions:
EmptyQueueException if this queue is empty.

Implements fr.dyade.aaa.agent.MessageQueue.

Definition at line 117 of file MessageVector.java.

References fr.dyade.aaa.agent.MessageVector.getMessageAt(), and fr.dyade.aaa.agent.MessageVector.removeMessageAt().

Referenced by fr.dyade.aaa.agent.UDPNetwork.NetServerOut.run(), and fr.dyade.aaa.agent.SimpleNetwork.NetServerOut.run().

Here is the call graph for this function:

synchronized void fr.dyade.aaa.agent.MessageVector.validate (  ) 

Atomicaly validates all messages pushed in queue during a reaction. It must only be used during a transaction.

Implements fr.dyade.aaa.agent.MessageQueue.

Definition at line 135 of file MessageVector.java.

References fr.dyade.aaa.agent.MessageVector.size().

Referenced by fr.dyade.aaa.agent.Network.validate().

Here is the call graph for this function:

synchronized Message fr.dyade.aaa.agent.MessageVector.get (  )  throws InterruptedException

Looks at the message at the top of this queue without removing it from the queue. It should never be used during a transaction to avoid dead-lock problems.

Returns:
the message at the top of this queue.
Exceptions:
InterruptedException if another thread has interrupted the current thread.

Implements fr.dyade.aaa.agent.MessageQueue.

Definition at line 152 of file MessageVector.java.

References fr.dyade.aaa.agent.MessageVector.getMessageAt().

Referenced by fr.dyade.aaa.agent.UDPNetwork.NetServerOut.run(), fr.dyade.aaa.agent.SimpleNetwork.NetServerOut.run(), and fr.dyade.aaa.agent.HttpNetwork.NetServerOut.run().

Here is the call graph for this function:

synchronized Message fr.dyade.aaa.agent.MessageVector.get ( long  timeout  )  throws InterruptedException

Looks at the message at the top of this queue without removing it from the queue. It should never be used during a transaction to avoid dead-lock problems. It waits until a message is available or the specified amount of time has elapsed.

Parameters:
timeout the maximum time to wait in milliseconds.
Returns:
the message at the top of this queue.
Exceptions:
InterruptedException if another thread has interrupted the current thread.
IllegalArgumentException if the value of timeout is negative.

Implements fr.dyade.aaa.agent.MessageQueue.

Definition at line 185 of file MessageVector.java.

References fr.dyade.aaa.agent.MessageVector.getMessageAt().

Here is the call graph for this function:

synchronized Message fr.dyade.aaa.agent.MessageVector.getMessageTo ( short  to  ) 

Looks at the first message of this queue where the destination server is the specified one. The message is not removed from the queue. It should never be used during a transaction to avoid dead-lock problems.

Parameters:
to the unique server id.
Returns:
the corresponding message or null if none .

Definition at line 214 of file MessageVector.java.

References fr.dyade.aaa.agent.MessageVector.getMessageAt().

Referenced by fr.dyade.aaa.agent.HttpNetwork.NetServerIn.run().

Here is the call graph for this function:

synchronized void fr.dyade.aaa.agent.MessageVector.removeMessage ( Message  msg  )  [package]

Removes the specified message from the queue if exists.

Parameters:
msg the message to remove.

Definition at line 244 of file MessageVector.java.

References fr.dyade.aaa.agent.MessageVector.getMessageAt(), fr.dyade.aaa.agent.Message.getStamp(), and fr.dyade.aaa.agent.MessageVector.removeMessageAt().

Referenced by fr.dyade.aaa.agent.HttpNetwork.handle(), fr.dyade.aaa.agent.HttpNetwork.NetServerIn.run(), and fr.dyade.aaa.agent.HttpNetwork.NetServerOut.run().

Here is the call graph for this function:

synchronized int fr.dyade.aaa.agent.MessageVector.remove ( int  stamp  )  [package]

Removes all messages with a stamp less than the specified one. Be careful with the use of this method, in particular it does not take in account the multiples incoming nodes.

Definition at line 273 of file MessageVector.java.

References fr.dyade.aaa.agent.MessageVector.getMessageAt(), and fr.dyade.aaa.agent.MessageVector.removeMessageAt().

Referenced by fr.dyade.aaa.agent.SimpleNetwork.ackMsg().

Here is the call graph for this function:

synchronized Message fr.dyade.aaa.agent.MessageVector.removeExpired ( long  currentTimeMillis  )  [package]

Removes the first messages with a timestamp less than the specified one. Be careful with the use of this method, in particular it does not take in account the multiples incoming nodes.

Definition at line 301 of file MessageVector.java.

References fr.dyade.aaa.agent.MessageVector.getMessageAt(), and fr.dyade.aaa.agent.MessageVector.removeMessageAt().

Referenced by fr.dyade.aaa.agent.HttpNetwork.NetServerOut.run().

Here is the call graph for this function:

void fr.dyade.aaa.agent.MessageVector.insertMessageAt ( Message  item,
int  index 
) [package]

Inserts the specified message to this MessageVector at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted upward.

Parameters:
item the message to be pushed onto this queue.
index where to insert the new message.

Definition at line 334 of file MessageVector.java.

Referenced by fr.dyade.aaa.agent.MessageVector.insert().

void fr.dyade.aaa.agent.MessageVector.addMessage ( Message  item  )  [package]

Adds the specified message to the end of internal Vector.

Parameters:
item the message to be added onto this queue.

Definition at line 369 of file MessageVector.java.

Referenced by fr.dyade.aaa.agent.MessageVector.push(), and fr.dyade.aaa.agent.SimpleNetwork.NetServerOut.run().

Message fr.dyade.aaa.agent.MessageVector.getMessageAt ( int  index  )  [package]

Returns the message at the specified index.

Parameters:
index the index of the message.
Returns:
The message at the top of this queue.

Definition at line 383 of file MessageVector.java.

Referenced by fr.dyade.aaa.agent.MessageVector.get(), fr.dyade.aaa.agent.MessageVector.getMessageTo(), fr.dyade.aaa.agent.MessageVector.insert(), fr.dyade.aaa.agent.MessageVector.pop(), fr.dyade.aaa.agent.MessageVector.remove(), fr.dyade.aaa.agent.MessageVector.removeExpired(), fr.dyade.aaa.agent.MessageVector.removeMessage(), and fr.dyade.aaa.agent.SimpleNetwork.NetServerOut.watchdog().

void fr.dyade.aaa.agent.MessageVector.removeMessageAt ( int  index  )  [package]

Deletes the message at the specified index.

Parameters:
index the index of the message to remove.

Definition at line 405 of file MessageVector.java.

Referenced by fr.dyade.aaa.agent.MessageVector.pop(), fr.dyade.aaa.agent.MessageVector.remove(), fr.dyade.aaa.agent.MessageVector.removeExpired(), fr.dyade.aaa.agent.MessageVector.removeMessage(), and fr.dyade.aaa.agent.SimpleNetwork.NetServerOut.watchdog().

int fr.dyade.aaa.agent.MessageVector.size (  ) 

Returns the number of messages in this vector.

Returns:
the number of messages in this vector.

Implements fr.dyade.aaa.agent.MessageQueue.

Definition at line 436 of file MessageVector.java.

Referenced by fr.dyade.aaa.agent.Network.getNbWaitingMessages(), fr.dyade.aaa.agent.Network.toString(), fr.dyade.aaa.agent.MessageVector.validate(), and fr.dyade.aaa.agent.SimpleNetwork.NetServerOut.watchdog().

String fr.dyade.aaa.agent.MessageVector.toString (  ) 

Returns a string representation of this MessageVector object. Be careful we scan the vector without synchronization, so the result can be incoherent.

Returns:
A string representation of this object.

Definition at line 447 of file MessageVector.java.


The documentation for this class was generated from the following file:
Generated on Tue Sep 16 16:16:33 2008 for joram by  doxygen 1.5.0