public class DefaultTimeServiceProvider extends TimeServiceProvider
TimeServiceProvider which assigns as current processing time the result of calling
System.currentTimeMillis() and registers timers using a ScheduledThreadPoolExecutor.| Modifier and Type | Method and Description |
|---|---|
static DefaultTimeServiceProvider |
create(ScheduledExecutorService executor) |
long |
getCurrentProcessingTime()
Returns the current processing time.
|
ScheduledFuture<?> |
registerTimer(long timestamp,
Runnable target)
Registers a task to be executed when (processing) time is
timestamp. |
void |
shutdownService()
Shuts down and clean up the timer service provider.
|
public static DefaultTimeServiceProvider create(ScheduledExecutorService executor)
public long getCurrentProcessingTime()
TimeServiceProvidergetCurrentProcessingTime in class TimeServiceProviderpublic ScheduledFuture<?> registerTimer(long timestamp, Runnable target)
TimeServiceProvidertimestamp.registerTimer in class TimeServiceProvidertimestamp - when the task is to be executed (in processing time)target - the task to be executedpublic void shutdownService()
throws Exception
TimeServiceProvidershutdownService in class TimeServiceProviderExceptionCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.