Package com.streambase.sb
Interface TimeService
public interface TimeService
This interface defines a contract that enables users to provide custom implementations of time used by StreamBase server
It must be implemented by all Time Service classes.
- Since:
- 7.4
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdvances the service time by a certain number of time units in the future.voidadvanceTo(long targetTimeMsec) Make the service advance to a specific time in the futuregetFutureTimestamp(long targetAdvance, TimeUnit timeUnit) Get the time stamp of a time point based on the specific time advancelongGet the current time in milliseconds from the perspective of this time service
-
Method Details
-
getTargetTime
long getTargetTime()Get the current time in milliseconds from the perspective of this time service- Returns:
- the current time in milliseconds
-
advanceBy
Advances the service time by a certain number of time units in the future.- Parameters:
timeAdvance- number of time units that the service should advance by. It should be a positive long valuetimeUnit- time unit- Throws:
StreamBaseException- advance error
-
advanceTo
Make the service advance to a specific time in the future- Parameters:
targetTimeMsec- Time to advance to. It must be greater than the service's current time- Throws:
StreamBaseException- advance to error
-
getFutureTimestamp
Get the time stamp of a time point based on the specific time advance- Parameters:
targetAdvance- time difference (in time units) between the future time point and the service's current time It must be 0 or a positive valuetimeUnit- time unit- Returns:
- a time stamp
-