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.
-
arbi
-
-
last_one_done
-
-
pending
-
-
queueNewActions
-
-
Serializer(Arbitrator)
-
-
checkPendingActions()
- After an action is received, this checks if the next one is
in the queue.
-
endQueueing()
-
-
getSerialNumber()
-
-
incoming(ServerMessage)
-
-
inOrder(ServerMessage)
-
-
inPast(ServerMessage)
-
-
matches(ServerMessage)
-
-
queueRequest(ServerMessage)
- This is called to put an early ServerMessage in our queue,
which is actually a hashtable indexed by ticketNumber
-
resetArbitrator(Arbitrator)
-
-
setSerialNumber(int)
-
-
startQueueing()
-
-
toString()
-
last_one_done
protected int last_one_done
arbi
protected Specifiable arbi
pending
protected transient Hashtable pending
queueNewActions
protected transient boolean queueNewActions
Serializer
public Serializer(Arbitrator arb)
- Parameters:
- arb - the arbitrator for this serializer
- Returns:
- creates the serializer
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.
endQueueing
public void endQueueing()
- Returns:
- Stop queueing actions, and execute any in the queue.
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.
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
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
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.
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.
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
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
setSerialNumber
public void setSerialNumber(int nNewNumber)
getSerialNumber
public int getSerialNumber()
- Returns:
- the serial number - should only be used by DistributedArbitrator
to allow the system to work in local mode
toString
public String toString()
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index