Rice Pastry API

rice.environment.time.simulated
Class DirectTimeSource

java.lang.Object
  extended by rice.environment.time.simulated.DirectTimeSource
All Implemented Interfaces:
Destructable, TimeSource

public class DirectTimeSource
extends java.lang.Object
implements TimeSource


Field Summary
protected  java.lang.String instance
           
protected  Logger logger
           
protected  java.util.HashSet<rice.environment.time.simulated.DirectTimeSource.BlockingTimerTask> pendingTimers
          When destry is called, throw an interrupted exception on all of these.
protected  SelectorManager selectorManager
           
protected  long time
           
 
Constructor Summary
DirectTimeSource(long time)
           
DirectTimeSource(long time, java.lang.String instance)
           
DirectTimeSource(Parameters p)
           
 
Method Summary
 long currentTimeMillis()
           
 void destroy()
          TODO: Get the synchronization on this correct
 void incrementTime(int millis)
          Should be synchronized on the selectorManager
 void setLogManager(LogManager manager)
           
 void setSelectorManager(SelectorManager sm)
           
 void setTime(long newTime)
          Should be synchronized on the selectorManager
 void sleep(long delay)
          block for this many millis
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

time

protected long time

logger

protected Logger logger

instance

protected java.lang.String instance

selectorManager

protected SelectorManager selectorManager

pendingTimers

protected java.util.HashSet<rice.environment.time.simulated.DirectTimeSource.BlockingTimerTask> pendingTimers
When destry is called, throw an interrupted exception on all of these.

Constructor Detail

DirectTimeSource

public DirectTimeSource(long time)

DirectTimeSource

public DirectTimeSource(long time,
                        java.lang.String instance)

DirectTimeSource

public DirectTimeSource(Parameters p)
Method Detail

setLogManager

public void setLogManager(LogManager manager)

setSelectorManager

public void setSelectorManager(SelectorManager sm)

currentTimeMillis

public long currentTimeMillis()
Specified by:
currentTimeMillis in interface TimeSource
Returns:
the current time in millis

setTime

public void setTime(long newTime)
Should be synchronized on the selectorManager

Parameters:
newTime -

incrementTime

public void incrementTime(int millis)
Should be synchronized on the selectorManager


sleep

public void sleep(long delay)
           throws java.lang.InterruptedException
Description copied from interface: TimeSource
block for this many millis

Specified by:
sleep in interface TimeSource
Parameters:
delay - the amount of time to sleep
Throws:
java.lang.InterruptedException

destroy

public void destroy()
TODO: Get the synchronization on this correct

Specified by:
destroy in interface Destructable

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection