

That require "smoothness." In other words, it is appropriate forĪctivities where it is more important to keep the frequency accurate Lower than the reciprocal of the specified period (assuming the systemĬlock underlying Object.wait(long) is accurate).įixed-delay execution is appropriate for recurring activities In the long run, the frequency of execution will generally be slightly Is delayed for any reason (such as garbage collection or otherīackground activity), subsequent executions will be delayed as well. The actual execution time of the previous execution. In fixed-delay execution, each execution is scheduled relative to Subsequent executions take placeĪt approximately regular intervals separated by the specified period. Schedules the specified task for repeated fixed-delay execution,īeginning after the specified delay. Implementation note: All constructors start a timer thread. It uses a binary heap to represent its task queue, so the cost to scheduleĪ task is O(log n), where n is the number of concurrently scheduled tasks. Scheduled tasks (thousands should present no problem). Implementation note: This class scales to large numbers of concurrently Configuring ScheduledThreadPoolExecutor with one thread makes it equivalent to Time units, and doesn't require subclassing TimerTask (just Versatile replacement for the Timer/ TimerTaskĬombination, as it allows multiple service threads, accepts various One of the concurrency utilities therein is the ScheduledThreadPoolExecutor which is a thread pool for repeatedlyĮxecuting tasks at a given rate or delay. Tasks using the Object.wait(long) method. This class does not offer real-time guarantees: it schedules Timer object without the need for external synchronization. This class is thread-safe: multiple threads can share a single IllegalStateException, as if the timer's cancel If the timer's task execution thread terminates unexpectedly, forĮxample, because its stop method is invoked, any furtherĪttempt to schedule a task on the timer will result in an Wants to terminate a timer's task execution thread rapidly, the caller So it is capable of keeping an application from terminating. Byĭefault, the task execution thread does not run as a daemon thread, However, this can take arbitrarily long to occur. Turn, delay the execution of subsequent tasks, which may "bunch up" andĮxecute in rapid succession when (and if) the offending task finallyĪfter the last live reference to a Timer object goes awayĪnd all outstanding tasks have completed execution, the timer's taskĮxecution thread terminates gracefully (and becomes subject to garbageĬollection). To complete, it "hogs" the timer's task execution thread. Thread that is used to execute all of the timer's tasks, sequentially. Tasks may be scheduled for one-time execution, or forĬorresponding to each Timer object is a single background For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.A facility for threads to schedule tasks for future execution in aīackground thread. The Linux Foundation has registered trademarks and uses trademarks. © Prometheus Authors 2014-2022 | Documentation Distributed under CC-BY-4.0 Please help improve it by filing issues or pull requests.
Java format int as timer counter series#
It also provides a sumĪ histogram with a base metric name of exposes multiple time series Response sizes) and counts them in configurable buckets. Memory usage, but also "counts" that can go up and down, like the number ofĬlient library usage documentation for gauges:Ī histogram samples observations (usually things like request durations or

Gauges are typically used for measured values like temperatures or current Use a counter for the number of currently running processes instead use a gauge.Ĭlient library usage documentation for counters:Ī gauge is a metric that represents a single numerical value that can

Use a counter to represent the number of requests served, tasks completed, orĭo not use a counter to expose a value that can decrease. Value can only increase or be reset to zero on restart. CounterĪ counter is a cumulative metric that represents a single monotonically Server does not yet make use of the type information and flattens all data into

To the usage of the specific types) and in the wire protocol. These areĬurrently only differentiated in the client libraries (to enable APIs tailored The Prometheus client libraries offer four core metric types.
