Adds an automatic timer to this metadata.

@param timer the automatic timer
433535
void addAutomaticTimer(AutomaticTimer timer)
    {
        timer.ivMethod = this;
        ivAutomaticTimers.add(timer);

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "added automatic timer: " + timer);
    }
545169
private void cancelAppendTimer() {
    if (appendTimer != null) {
      LOGGER.trace("{} - Cancelling append timer", context.getCluster().member().address());
      appendTimer.cancel();
    }
  }
50745
public void addChangingSimons() {
		timer.schedule(new TimerTask() {
			final Stopwatch tlStopwatch = SimonManager.getStopwatch("TL");

			@Override
			public void run() {
				try {
					lock.lock();
					System.out.println("TL " + addStopwatchSplit(tlStopwatch));
				} finally {
					lock.unlock();
				}
			}
		}, 0, 10000L);
	}
991131
@Override
  public void onTimer(String timerName) {
    if (timerName.equals(IDLE_SESSION_TIMER_NAME)) {
      checkIdleAppSession();
    }
    else if (timerName.equals(TCC_TIMER_NAME)) {
      new TccScheduledTask(this).run();
    }
    else {
      logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId());
    }
  }
724453
public void addTimer(long timeout, IPollEvents sink, int id)
    {
        assert (Thread.currentThread() == worker);

        final long expiration = clock() + timeout;
        TimerInfo info = new TimerInfo(sink, id);
        timers.insert(expiration, info);

        changed = true;
    }
489579
public Timer timer(String name, Iterable<Tag> tags) {
        return Timer.builder(name).tags(tags).register(this);
    }
485279
public boolean addTimer(VacuumTimer timer) throws CommandExecutionException {
        if (timer == null) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_PARAMETERS);
        JSONArray tm = timer.construct();
        if (tm == null) return false;
        JSONArray payload = new JSONArray();
        payload.put(tm);
        return sendOk("set_timer", payload);
    }
1036063
public static void start(String name) {
    if (!active) return;

    TimerNode root = new TimerNode(name, System.currentTimeMillis());
    TimerStack stack = (TimerStack) curStack.get();
    if (null == stack) curStack.set(new TimerStack(root));
    else stack.push(root);
  }
1294524
public synchronized void add(Timer other) {
        this.numStarts += other.numStarts;
        this.totMs += other.totMs;
        this.maxSplitMs = Math.max(this.maxSplitMs, other.maxSplitMs);
        this.sumSqMs += other.sumSqMs;
    }
897349
public final void initializeInternalTimer() {
        // if it is the first the instance is started, we initialize the
        // internal timer thread
        if (!internalTimerInitialized) {

            TimerTask internalTimerTask = new TimerTask() {

                /**
                 * this method is triggered every TIMER_INTERVAL_MILLIS
                 */
                @Override
                public void run() {

                    if (terminated) {
                        running = false;
                        booting = false;
                        stopping = false;
                        pubDns = null;
                        this.cancel();
                        onTerminated();
                        return;
                    }

                    if (running) {

                        if (booting) {

                            // delay a random 'boot time'
                            if (MAX_BOOT_TIME_MILLS != 0) {
                                try {
                                    Thread.sleep(MIN_BOOT_TIME_MILLS
                                            + random.nextInt((int) (MAX_BOOT_TIME_MILLS
                                                    - MIN_BOOT_TIME_MILLS)));
                                } catch (InterruptedException e) {
                                    throw new AwsMockException(
                                            "InterruptedException caught when delaying a mock random 'boot time'",
                                            e);
                                }
                            }

                            // booted, assign a mock pub dns name
                            pubDns = generatePubDns();

                            booting = false;

                            onBooted();

                        } else if (stopping) {

                            // delay a random 'shutdown time'
                            if (MAX_SHUTDOWN_TIME_MILLS != 0) {
                                try {
                                    Thread.sleep(MIN_SHUTDOWN_TIME_MILLS
                                            + random.nextInt((int) (MAX_SHUTDOWN_TIME_MILLS
                                                    - MIN_SHUTDOWN_TIME_MILLS)));
                                } catch (InterruptedException e) {
                                    throw new AwsMockException(
                                            "InterruptedException caught when delaying a mock random 'shutdown time'",
                                            e);
                                }
                            }

                            // unset pub dns name
                            pubDns = null;

                            stopping = false;

                            running = false;

                            onStopped();

                        }

                        onInternalTimer();

                    }

                }
            };
            timer = new SerializableTimer(true);
            timer.schedule(internalTimerTask, 0L, TIMER_INTERVAL_MILLIS);

            internalTimerInitialized = true;
        }
    }
592451
def _remove(self, timer):
        """"""
        assert timer.timer_heap == self
        del self.timers[timer]
        assert timer in self.heap
        self.heap.remove(timer)
        heapq.heapify(self.heap)
1225330
protected void setTimeoutTime(int time) {
        int timeout = time;
        if (timeout == TCPRequestContext.NO_TIMEOUT) {
            this.timeoutTime = TCPRequestContext.NO_TIMEOUT;
            this.timeoutInterval = 0;
        } else {
            if (timeout == TCPRequestContext.USE_CHANNEL_TIMEOUT) {
                timeout = getConfig().getInactivityTimeout();
            }
            if (timeout != ValidateUtils.INACTIVITY_TIMEOUT_NO_TIMEOUT) {
                this.timeoutTime = System.currentTimeMillis() + timeout;
                this.timeoutInterval = timeout;
            } else {
                this.timeoutTime = TCPRequestContext.NO_TIMEOUT;
                this.timeoutInterval = 0;
            }
        }
    }
1144297
public synchronized void schedule()
    {
        // Avoid scheduling a timer that was destroyed on another thread and
        // avoid scheduling a timer twice, which might be attempted if two
        // threads concurrently attempt to cancel and then both rollback.
        if (ivTaskHandler == null && !ivDestroyed)
        {
            // Create the timer task handler (Runnable/Listener) and schedule the task
            ivTaskHandler = ivContainer.getEJBRuntime().createNonPersistentTimerTaskHandler(this);

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "schedule: scheduling timer for " + ivExpiration + " / " + new Date(ivExpiration));

            ivTaskHandler.schedule(ivExpiration);
        }
        else
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "schedule: timer already scheduled or destroyed : destroyed=" + ivDestroyed);
        }
    }
206558
public S animate(Timer timer)
	{
		long elapsed = timer.elapsedTime() - Timer.tickToTime(delay);
		started = elapsed > transform.getDelay();
		finished = elapsed > transform.totalDuration() && transform.getLoops() != -1;

		if (!started && !renderBefore)
			return null;
		if (finished && !renderAfter)
			return null;

		transform.transform(transformable, elapsed);
		return transformable;
	}
1115830
public void initTimer(){
		stopTimer();
		if(this.WRITE_CACHE_ENABLED) {
			logger.debug("configuring write cache with defaults");
			timerWriteCache = new TripleWriteCache(this);
			writeTimer = new Timer();
			writeTimer.scheduleAtFixedRate(timerWriteCache, TripleWriteCache.DEFAULT_INITIAL_DELAY, TripleWriteCache.DEFAULT_CACHE_MILLIS);
		}
		if(this.DELETE_CACHE_ENABLED) {
			logger.debug("configuring delete cache with defaults");
			timerDeleteCache = new TripleDeleteCache(this);
			deleteTimer = new Timer();
			deleteTimer.scheduleAtFixedRate(timerDeleteCache, TripleDeleteCache.DEFAULT_INITIAL_DELAY, TripleDeleteCache.DEFAULT_CACHE_MILLIS);
		}
	}
324127
private Metric collectTimer(MetricName dropwizardMetric, Timer timer) {
    String metricName = DropWizardUtils.generateFullMetricName(dropwizardMetric.getKey(), "timer");
    String metricDescription =
        DropWizardUtils.generateFullMetricDescription(dropwizardMetric.getKey(), timer);
    final AbstractMap.SimpleImmutableEntry<List<LabelKey>, List<LabelValue>> labels =
        DropWizardUtils.generateLabels(dropwizardMetric);
    return collectSnapshotAndCount(
        metricName,
        metricDescription,
        labels.getKey(),
        labels.getValue(),
        NS_UNIT,
        timer.getSnapshot(),
        timer.getCount());
  }
917421
public void register(int interval, @NonNull OnTickListener onTickListener, boolean intermediate) {
        mDefaultTimer.register(interval, onTickListener, intermediate);
    }