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()
TimeServiceProvider
getCurrentProcessingTime
in class TimeServiceProvider
public ScheduledFuture<?> registerTimer(long timestamp, Runnable target)
TimeServiceProvider
timestamp
.registerTimer
in class TimeServiceProvider
timestamp
- when the task is to be executed (in processing time)target
- the task to be executedpublic void shutdownService() throws Exception
TimeServiceProvider
shutdownService
in class TimeServiceProvider
Exception
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.