public class TimeService
extends java.lang.Object
implements java.lang.Runnable
System.currentTimeMillis()
and returns the cached value. This is way faster than calling System.currentTimeMillis()
many times, e.g.
for each received message. The granularity (interval) can be chosen by the user.限定符和类型 | 字段和说明 |
---|---|
protected long |
interval |
protected java.util.concurrent.Future<?> |
task |
protected TimeScheduler |
timer |
protected long |
timestamp |
构造器和说明 |
---|
TimeService(TimeScheduler timer) |
TimeService(TimeScheduler timer,
long interval) |
限定符和类型 | 方法和说明 |
---|---|
long |
interval() |
TimeService |
interval(long interval) |
void |
run() |
boolean |
running() |
TimeService |
start() |
protected void |
startTask() |
TimeService |
stop() |
protected void |
stopTask() |
long |
timestamp() |
java.lang.String |
toString() |
protected TimeScheduler timer
protected volatile java.util.concurrent.Future<?> task
protected long interval
protected volatile long timestamp
public TimeService(TimeScheduler timer)
public TimeService(TimeScheduler timer, long interval)
public long timestamp()
public long interval()
public TimeService interval(long interval)
public boolean running()
public TimeService start()
public TimeService stop()
public void run()
run
在接口中 java.lang.Runnable
public java.lang.String toString()
toString
在类中 java.lang.Object
protected void startTask()
protected void stopTask()