KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > util > TestTimer


1 /**
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.util;
5
6 import java.util.ArrayList JavaDoc;
7 import java.util.Date JavaDoc;
8 import java.util.List JavaDoc;
9 import java.util.TimerTask JavaDoc;
10
11 public class TestTimer implements TCTimer {
12
13   public List JavaDoc scheduleCalls = new ArrayList JavaDoc();
14   public List JavaDoc cancelCalls = new ArrayList JavaDoc();
15
16   public void cancel() {
17     cancelCalls.add(new Object JavaDoc());
18   }
19
20   public void schedule(TimerTask JavaDoc task, long delay) {
21     scheduleCalls.add(new ScheduleCallContext(task, new Long JavaDoc(delay), null, null));
22   }
23
24   public void schedule(TimerTask JavaDoc task, Date JavaDoc time) {
25     return;
26
27   }
28
29   public void schedule(TimerTask JavaDoc task, long delay, long period) {
30     return;
31
32   }
33
34   public void schedule(TimerTask JavaDoc task, Date JavaDoc firstTime, long period) {
35     return;
36
37   }
38
39   public void scheduleAtFixedRate(TimerTask JavaDoc task, long delay, long period) {
40     return;
41
42   }
43
44   public void scheduleAtFixedRate(TimerTask JavaDoc task, Date JavaDoc firstTime, long period) {
45     return;
46
47   }
48
49   public static final class ScheduleCallContext {
50     public final TimerTask JavaDoc task;
51     public final Long JavaDoc delay;
52     public final Date JavaDoc time;
53     public final Long JavaDoc period;
54
55     private ScheduleCallContext(TimerTask JavaDoc task, Long JavaDoc delay, Date JavaDoc time, Long JavaDoc period) {
56       this.task = task;
57       this.delay = delay;
58       this.time = time;
59       this.period = period;
60     }
61   }
62
63 }
64
Popular Tags