Lines Matching defs:timer
117 void addTimer(Timer timer, long delayMillis) {
118 timer.getLock().lock();
121 if (! containsTimer(timer)) {
122 addTimer(new DelayedTimer(timer,
127 timer.getLock().unlock();
134 Timer timer = delayedTimer.getTimer();
135 timer.getLock().lock();
137 timer.delayedTimer = delayedTimer;
140 timer.getLock().unlock();
144 void removeTimer(Timer timer) {
145 timer.getLock().lock();
147 if (timer.delayedTimer != null) {
148 queue.remove(timer.delayedTimer);
149 timer.delayedTimer = null;
152 timer.getLock().unlock();
156 boolean containsTimer(Timer timer) {
157 timer.getLock().lock();
159 return timer.delayedTimer != null;
161 timer.getLock().unlock();
171 Timer timer = queue.take().getTimer();
172 timer.getLock().lock();
174 DelayedTimer delayedTimer = timer.delayedTimer;
178 * the queue and before the lock on the timer is
181 timer.post(); // have timer post an event
182 timer.delayedTimer = null;
183 if (timer.isRepeats()) {
186 timer.getDelay()));
192 timer.getLock().newCondition().awaitNanos(1);
195 timer.getLock().unlock();
258 private final Timer timer;
260 DelayedTimer(Timer timer, long nanos) {
261 this.timer = timer;
276 return timer;