activemq-cpp-3.9.5
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
25namespace decaf {
26namespace internal{
27 namespace util{
28 class TimerTaskHeap;
29 }
30}
31namespace 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.
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
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_ */
A Binary Heap implemented specifically for the Timer class in Decaf Util.
Definition TimerTaskHeap.h:38
Interface for a runnable object - defines a task that can be run by a thread.
Definition Runnable.h:29
A facility for threads to schedule tasks for future execution in a background thread.
Definition Timer.h:56
friend class TimerImpl
Definition TimerTask.h:55
void setScheduledTime(long long time)
friend class Timer
Definition TimerTask.h:54
virtual ~TimerTask()
Definition TimerTask.h:61
bool cancel()
Cancels this timer task.
long long scheduledExecutionTime() const
Returns the scheduled execution time of the most recent actual execution of this task.
bool isScheduled() const
long long getWhen() const
Mutex object that offers recursive support on all platforms as well as providing the ability to use t...
Definition Mutex.h:39
#define DECAF_API
Definition Config.h:29
Definition ByteArrayAdapter.h:30
Definition AprPool.h:26
Definition AbstractCollection.h:33
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25