All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.habanero.granted.Serializer

java.lang.Object
   |
   +----ncsa.habanero.granted.Serializer

public class Serializer
extends Object
implements Marshallable
The Serializer class makes sure that each action for which it is responsible (at present, that means all the actions for a particular collobject) is executed in order, and only once. To that end, it queues out of order ServerMessages, and throws away duplicate ones. There is conceptually one serializer for each TicketGranter, and thus one for each Arbitrator.


Variable Index

 o arbi
 o last_one_done
 o pending
 o queueNewActions

Constructor Index

 o Serializer(Arbitrator)

Method Index

 o checkPendingActions()
After an action is received, this checks if the next one is in the queue.
 o endQueueing()
 o getSerialNumber()
 o incoming(ServerMessage)
 o inOrder(ServerMessage)
 o inPast(ServerMessage)
 o matches(ServerMessage)
 o queueRequest(ServerMessage)
This is called to put an early ServerMessage in our queue, which is actually a hashtable indexed by ticketNumber
 o resetArbitrator(Arbitrator)
 o setSerialNumber(int)
 o startQueueing()
 o toString()

Variables

 o last_one_done
 protected int last_one_done
 o arbi
 protected Specifiable arbi
 o pending
 protected transient Hashtable pending
 o queueNewActions
 protected transient boolean queueNewActions

Constructors

 o Serializer
 public Serializer(Arbitrator arb)
Parameters:
arb - the arbitrator for this serializer
Returns:
creates the serializer

Methods

 o startQueueing
 public void startQueueing()
Returns:
This is used to tell the Serializer to queue actions rather than allowing them to be executed. It can be used to "freeze" an Arbitrator.
 o endQueueing
 public void endQueueing()
Returns:
Stop queueing actions, and execute any in the queue.
 o matches
 protected int matches(ServerMessage request)
Parameters:
request - the action request
Returns:
Tells whether the ServerMessage's ticket number matches the Serializer's idea of the next number to execute. If queueing is enables, it returns Ticket.NOT_YET, which results in queueing the ServerMessage.
 o inOrder
 public boolean inOrder(ServerMessage request)
Parameters:
request - the action that needs to be determined if it is in order
Returns:
true if this action's time is now
 o inPast
 public boolean inPast(ServerMessage request)
Parameters:
request - the action that needs to be determined if it is in order
Returns:
true if the collobject has already processed this action
 o incoming
 public void incoming(ServerMessage request)
Parameters:
request - the action that has been granted
Returns:
This method is called by the router. It checks if the Action represented by the ActionGranted can be executed, and if so asks the ActionGranted to do so. It queues out of order ActionGranteds, and throws away duplicate ones.
 o checkPendingActions
 protected void checkPendingActions()
After an action is received, this checks if the next one is in the queue. If so, it calls incoming with it. Note that this is then recursively called.

 o queueRequest
 protected void queueRequest(ServerMessage request)
This is called to put an early ServerMessage in our queue, which is actually a hashtable indexed by ticketNumber

 o resetArbitrator
 public void resetArbitrator(Arbitrator newArbi)
Parameters:
newArbi - the new arbitrator
Returns:
FOR FRAMEWORK USE ONLY - resets the arbitrator in the serializer once it has been copied
 o setSerialNumber
 public void setSerialNumber(int nNewNumber)
 o getSerialNumber
 public int getSerialNumber()
Returns:
the serial number - should only be used by DistributedArbitrator to allow the system to work in local mode
 o toString
 public String toString()
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index