| |
|
| java.lang.Object org.prevayler.implementation.SystemClock
SystemClock | public class SystemClock implements AlarmClock(Code) | | An AlarmClock that uses the local system clock as its current-time source.
This class can be extended so that other time sources can be used.
See Also: SystemClock.currentTimeMillis() |
Constructor Summary | |
public | SystemClock() A newly created SystemClock starts off paused with time() equal to new Date(Long.MIN_VALUE). |
Method Summary | |
protected long | currentTimeMillis() Returns System.currentTimeMillis(). | synchronized void | pause() Causes time() to return always the same value as if the clock had stopped.
The clock does NOT STOP internally though. | synchronized void | recover(long newMillis) Sets the time forward, recovering some of the time that was "lost" since the clock was paused. | synchronized void | resume() Causes time() to return the current time again. | public synchronized Date | time() |
SystemClock | public SystemClock()(Code) | | A newly created SystemClock starts off paused with time() equal to new Date(Long.MIN_VALUE).
|
currentTimeMillis | protected long currentTimeMillis()(Code) | | Returns System.currentTimeMillis(). Override this method if you want to use a different time source for your system.
|
pause | synchronized void pause()(Code) | | Causes time() to return always the same value as if the clock had stopped.
The clock does NOT STOP internally though. This method is called by Prevayler before each Command is executed so that it can be executed in a known moment in time.
See Also: SystemClock.resume() |
recover | synchronized void recover(long newMillis)(Code) | | Sets the time forward, recovering some of the time that was "lost" since the clock was paused. The clock must be paused. This method is called by Prevayler when recovering commands from the commandLog file so that they can be re-executed in the "same" time as they had been originally.
Parameters: newMillis - the new time in milliseconds. Cannot be earlier than time().getTime() and cannot be later than currentTimeMillis(). |
resume | synchronized void resume()(Code) | | Causes time() to return the current time again. This method is called by Prevayler after each Command is executed so that the clock can start running again.
See Also: SystemClock.pause() |
|
|
|