public class ClockService extends BasicService implements IClockService, IPropertiesProvider
TYPEEMPTY_SERVICES| Constructor and Description |
|---|
ClockService(ClockCreationInfo cinfo,
IServiceProvider provider)
Create a new clock service.
|
ClockService(ClockCreationInfo cinfo,
IServiceProvider provider,
Map properties)
Create a new clock service.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChangeListener(IChangeListener listener)
Add a change listener.
|
boolean |
advanceEvent()
Advance one event.
|
static IClock |
createClock(ClockCreationInfo cinfo,
IThreadPool tp)
Create a clock.
|
ITimer |
createTickTimer(ITimedObject to)
Create a new tick timer.
|
ITimer |
createTimer(long time,
ITimedObject to)
Create a new timer.
|
String |
getClockType()
Get the clock type.
|
long |
getDelta()
Get the clock delta.
|
double |
getDilation()
Get the clocks dilation.
|
ITimer |
getNextTimer()
Get the next timer.
|
IFuture<Properties> |
getProperties()
Write current state into properties.
|
long |
getStarttime()
Get the clocks start time.
|
String |
getState()
Get the clock state.
|
double |
getTick()
Get the current tick.
|
long |
getTime()
Get the current time.
|
ITimer[] |
getTimers()
Get all active timers.
|
void |
removeChangeListener(IChangeListener listener)
Remove a change listener.
|
void |
setClock(String type,
IThreadPool tp)
Set the clock.
|
void |
setDelta(long delta)
Set the clock delta.
|
void |
setDilation(double dilation)
Set the clocks dilation.
|
IFuture<Void> |
setProperties(Properties props)
Update from given properties.
|
IFuture |
shutdownService()
Shutdown the service.
|
void |
start()
Start the clock.
|
IFuture<Void> |
startService()
Start the service.
|
void |
stop()
Stop the clock.
|
createServiceIdentifier, createServiceIdentifier, equals, generateServiceName, getPropertyMap, getServiceIdentifier, isValid, setPropertyMapgetClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPropertyMap, getServiceIdentifier, isValidpublic ClockService(ClockCreationInfo cinfo, IServiceProvider provider)
public ClockService(ClockCreationInfo cinfo, IServiceProvider provider, Map properties)
public long getTime()
getTime in interface IClockServicepublic double getTick()
getTick in interface IClockServicepublic long getStarttime()
getStarttime in interface IClockServicepublic long getDelta()
getDelta in interface IClockServicepublic void setDelta(long delta)
setDelta in interface IClockServicedelta - The new clock delta.public String getState()
getState in interface IClockServicepublic double getDilation()
getDilation in interface IClockServicepublic void setDilation(double dilation)
setDilation in interface IClockServicedilation - The clocks dilation.
// Hack. Remove? only for continuouspublic String getClockType()
getClockType in interface IClockServicepublic ITimer createTimer(long time, ITimedObject to)
System.currentTimeMillis().createTimer in interface IClockServicetimespan - The relative timespan after which the timed object should be notified.to - The timed object.public ITimer createTickTimer(ITimedObject to)
createTickTimer in interface IClockServiceto - The timed object.public ITimer getNextTimer()
getNextTimer in interface IClockServicepublic ITimer[] getTimers()
getTimers in interface IClockServicepublic void addChangeListener(IChangeListener listener)
addChangeListener in interface IClockServicelistener - The change listener.public void removeChangeListener(IChangeListener listener)
removeChangeListener in interface IClockServicelistener - The change listener.public boolean advanceEvent()
advanceEvent in interface IClockServicepublic void start()
start in interface IClockServicepublic void stop()
stop in interface IClockServicepublic IFuture<Void> startService()
startService in interface IInternalServicestartService in class BasicServicepublic IFuture shutdownService()
shutdownService in interface IInternalServiceshutdownService in class BasicServicelistener - The listener.public void setClock(String type, IThreadPool tp)
setClock in interface IClockServiceclock - The new clock.public static IClock createClock(ClockCreationInfo cinfo, IThreadPool tp)
public IFuture<Void> setProperties(Properties props)
setProperties in interface IPropertiesProviderpublic IFuture<Properties> getProperties()
getProperties in interface IPropertiesProviderCopyright © 2012. All Rights Reserved.