Mercurial > hg > blitz_stable
comparison src/org/prevayler/implementation/ClockRecoveryCommand.java @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3dc0c5604566 |
---|---|
1 package org.prevayler.implementation; | |
2 | |
3 import org.prevayler.*; | |
4 | |
5 import java.io.Serializable; | |
6 | |
7 import java.util.Date; | |
8 | |
9 /** | |
10 A command for executing another command at a specific moment in time. | |
11 */ | |
12 class ClockRecoveryCommand implements Command { | |
13 static final long serialVersionUID = 4156866783673937422L; | |
14 | |
15 private Command command; | |
16 private long millis; | |
17 | |
18 public ClockRecoveryCommand(Command command, Date date) { | |
19 this.command = command; | |
20 this.millis = date.getTime(); | |
21 } | |
22 | |
23 public Serializable execute(PrevalentSystem system) throws Exception { | |
24 ((SystemClock)system.clock()).recover(millis); | |
25 return command.execute(system); | |
26 } | |
27 | |
28 public String toString() { | |
29 return millis + ":" + command; | |
30 } | |
31 | |
32 public long getMillis() { | |
33 return millis; | |
34 } | |
35 } |