00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _DECAF_UTIL_TIMERTASK_H_
00019 #define _DECAF_UTIL_TIMERTASK_H_
00020
00021 #include <decaf/util/Config.h>
00022 #include <decaf/lang/Runnable.h>
00023 #include <decaf/util/concurrent/Mutex.h>
00024
00025 namespace decaf {
00026 namespace internal{
00027 namespace util{
00028 class TimerTaskHeap;
00029 }
00030 }
00031 namespace util {
00032
00033 class Timer;
00034 class TimerImpl;
00035
00042 class DECAF_API TimerTask : public lang::Runnable {
00043 private:
00044
00045
00046 mutable decaf::util::concurrent::Mutex lock;
00047
00048 bool fixedRate;
00049 bool cancelled;
00050 long long scheduledTime;
00051 long long when;
00052 long long period;
00053
00054 friend class Timer;
00055 friend class TimerImpl;
00056 friend class decaf::internal::util::TimerTaskHeap;
00057
00058 public:
00059
00060 TimerTask();
00061 virtual ~TimerTask() {}
00062
00080 bool cancel();
00081
00104 long long scheduledExecutionTime() const;
00105
00106 protected:
00107
00108 bool isScheduled() const;
00109 void setScheduledTime(long long time);
00110 long long getWhen() const;
00111
00112 };
00113
00114 }}
00115
00116 #endif