org.objectweb.dream.protocol.bus.logicalClock
Class MatrixClock

java.lang.Object
  extended by org.objectweb.dream.AbstractComponent
      extended by 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.


Field Summary
protected  ChunkFactoryReference<LogicalClockChunk> logicalClockChunkFactory
           
protected  String logicalClockChunkName
           
protected  int[][] matrix
           
protected  MessageManager messageManager
           
protected  int myAddress
           
protected  int size
           
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, fcNeedAsyncStart, fcState, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.protocol.bus.logicalClock.LogicalClock
ALREADY_DELIVERED, DELIVER, LOGICAL_CLOCK_ITF_NAME, WAIT_TO_DELIVER
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
MatrixClock(int size, int myAddress, String logicalClockChunkName, MessageManager messageManager)
           
 
Method Summary
protected  Object getStamp(int to)
           
 String[] listFc()
           
 void stamp(Message message, int to)
          Stamps the given message.
 void startFc()
           
protected  int testRecvMatrix(Object stamp, int from)
           
 int testRecvMessage(Message message)
          Test if the given message can be delivered.
 
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
 

Field Detail

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
Constructor Detail

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.
Method Detail

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 stamp
to - 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.