01: package org.jgroups.util;
02:
03: /**
04: * Task which is executed immediately and only one time
05: * @author Bela Ban
06: * @version $Id: ImmediateTask.java,v 1.1 2006/09/04 07:33:25 belaban Exp $
07: */
08: public class ImmediateTask implements TimeScheduler.Task {
09: boolean executed = false;
10: Runnable r;
11:
12: public ImmediateTask(Runnable r) {
13: this .r = r;
14: }
15:
16: public boolean cancelled() {
17: return executed;
18: }
19:
20: public long nextInterval() {
21: return 0;
22: }
23:
24: public void run() {
25: executed = true;
26: if (r != null)
27: r.run();
28: }
29: }
|