org.objectweb.dream.protocol.bus.logicalClock
Class MatrixClock
java.lang.Object
org.objectweb.dream.AbstractComponent
org.objectweb.dream.protocol.bus.logicalClock.MatrixClock
- All Implemented Interfaces:
- ContextualBindingController, NeedAsyncStartController, PrepareStopLifeCycleController, Loggable, LogicalClock, BindingController, LifeCycleController
public class MatrixClock
- extends AbstractComponent
- implements LogicalClock
Basic Implementation of a matrix clock. Stamps used by this component are
integer arrays. This implementation is not efficient if the number of process
involved in the causality order is important.
Methods inherited from class org.objectweb.dream.AbstractComponent |
beforeFirstStart, bindFc, bindFc, getFcNeedAsyncStart, getFcState, initComponent, lookupFc, prepareStopFc, setLogger, stopFc, unbindFc |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
matrix
protected int[][] matrix
myAddress
protected int myAddress
size
protected int size
logicalClockChunkName
protected String logicalClockChunkName
messageManager
protected MessageManager messageManager
logicalClockChunkFactory
protected ChunkFactoryReference<LogicalClockChunk> logicalClockChunkFactory
MatrixClock
public MatrixClock(int size,
int myAddress,
String logicalClockChunkName,
MessageManager messageManager)
- Parameters:
size
- the bus size;myAddress
- the local address in the bus.logicalClockChunkName
- the name of the chunk to add in the message.messageManager
- the message manager.
testRecvMessage
public int testRecvMessage(Message message)
- Description copied from interface:
LogicalClock
- Test if the given message can be delivered. If the message is ready to be
delivered, the method returns
DELIVER
. If the message has
already been delivered, the method returns ALREADY_DELIVERED
,
and if other messages are waited before this message the method returns
WAIT_TO_DELIVER
.
- Specified by:
testRecvMessage
in interface LogicalClock
- Parameters:
message
- the message to test.
- Returns:
DELIVER
,ALREADY_DELIVERED
, or
WAIT_TO_DELIVER
code.- See Also:
LogicalClock.testRecvMessage(Message)
stamp
public void stamp(Message message,
int to)
- Description copied from interface:
LogicalClock
- Stamps the given message.
- Specified by:
stamp
in interface LogicalClock
- Parameters:
message
- a message to stampto
- the address of the destination process.- See Also:
LogicalClock.stamp(Message, int)
listFc
public String[] listFc()
- Specified by:
listFc
in interface BindingController
- See Also:
BindingController.listFc()
startFc
public void startFc()
throws IllegalLifeCycleException
- Specified by:
startFc
in interface LifeCycleController
- Overrides:
startFc
in class AbstractComponent
- Throws:
IllegalLifeCycleException
- See Also:
LifeCycleController.startFc()
testRecvMatrix
protected int testRecvMatrix(Object stamp,
int from)
getStamp
protected Object getStamp(int to)
Copyright © 2003, 2005 - INRIA Rhone-Alpes - All Rights Reserved.