public class Ticker extends Object implements Runnable
| Constructor and Description |
|---|
Ticker()
Creates a new ticker with a default thread factory (which uses
DumpingThreads). |
Ticker(ThreadFactory threadFactory)
Creates a new ticker that uses the given thread factory to create new
threads.
|
| Modifier and Type | Method and Description |
|---|---|
void |
changeExecutionTime(Object identifierObject,
long newExecutionTime)
Changes the execution time of the thread identified by the given object.
|
void |
deregisterEvent(Object eventIdentifier)
Removes the event identified by the given identifier.
|
static Ticker |
getInstance()
Returns the global ticker instance.
|
Object |
registerEvent(long executionTime,
Runnable thread)
Deprecated.
Use
registerEvent(long, Runnable, String) instead. |
Object |
registerEvent(long executionTime,
Runnable thread,
String eventName)
Registers a named thread that is executed at the specified time.
|
void |
run()
Main ticker thread.
|
void |
stop()
Stops the ticker.
|
public Ticker()
DumpingThreads).public Ticker(ThreadFactory threadFactory)
threadFactory - The thread factory to use for new threadspublic static Ticker getInstance()
@Deprecated public Object registerEvent(long executionTime, Runnable thread)
registerEvent(long, Runnable, String) instead.executionTime - Time of execution (in milliseconds since the epoch)thread - The thread to executepublic Object registerEvent(long executionTime, Runnable thread, String eventName)
executionTime - Time of execution (in milliseconds since the epoch)thread - The thread to executeeventName - The name of the eventpublic void changeExecutionTime(Object identifierObject, long newExecutionTime)
identifierObject - The object that identifies the ticker object to changenewExecutionTime - The new execution time for the threadpublic void deregisterEvent(Object eventIdentifier)
eventIdentifier is an object that was returned by a previous
call to registerEvent(long, Runnable).eventIdentifier - The identifier of the event to removepublic void stop()
Copyright © 2026. All rights reserved.