activemq-cpp-3.8.2
TimerTask.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _DECAF_UTIL_TIMERTASK_H_
19 #define _DECAF_UTIL_TIMERTASK_H_
20 
21 #include <decaf/util/Config.h>
22 #include <decaf/lang/Runnable.h>
24 
25 namespace decaf {
26 namespace internal{
27  namespace util{
28  class TimerTaskHeap;
29  }
30 }
31 namespace util {
32 
33  class Timer;
34  class TimerImpl;
35 
43  private:
44 
45  // Timer will use this lock to sync with mutating methods in this class.
46  mutable decaf::util::concurrent::Mutex lock;
47 
48  bool fixedRate;
49  bool cancelled;
50  long long scheduledTime;
51  long long when;
52  long long period;
53 
54  friend class Timer;
55  friend class TimerImpl;
57 
58  public:
59 
60  TimerTask();
61  virtual ~TimerTask() {}
62 
80  bool cancel();
81 
104  long long scheduledExecutionTime() const;
105 
106  protected:
107 
108  bool isScheduled() const;
109  void setScheduledTime(long long time);
110  long long getWhen() const;
111 
112  };
113 
114 }}
115 
116 #endif /* _DECAF_UTIL_TIMERTASK_H_ */
Mutex object that offers recursive support on all platforms as well as providing the ability to use t...
Definition: Mutex.h:39
A facility for threads to schedule tasks for future execution in a background thread.
Definition: Timer.h:56
virtual ~TimerTask()
Definition: TimerTask.h:61
#define DECAF_API
Definition: Config.h:29
Interface for a runnable object - defines a task that can be run by a thread.
Definition: Runnable.h:29
A Base class for a task object that can be scheduled for one-time or repeated execution by a Timer...
Definition: TimerTask.h:42
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25
A Binary Heap implemented specifically for the Timer class in Decaf Util.
Definition: TimerTaskHeap.h:38