public class DefaultTimingProvider extends java.lang.Object implements TimingProvider
| Constructor and Description |
|---|
DefaultTimingProvider() |
| Modifier and Type | Method and Description |
|---|---|
long |
convertToClusterTime(long timestamp)
Converts a local timestamp to cluster time.
|
void |
initialize(long clusterTimeOffset,
boolean isTimeSyncSupported)
Initialize timing provider with cluster time offset.
|
boolean |
isTimeSyncSupported()
Returns whether time sync is supported or not
|
long |
provideTimestampInMilliseconds()
Provide the current timestamp in milliseconds.
|
void |
sleep(long milliseconds)
Sleep given amount of milliseconds.
|
public long provideTimestampInMilliseconds()
TimingProviderprovideTimestampInMilliseconds in interface TimingProviderpublic void sleep(long milliseconds)
throws java.lang.InterruptedException
TimingProvidersleep in interface TimingProviderjava.lang.InterruptedException - When the sleep call gets interrupted.public void initialize(long clusterTimeOffset,
boolean isTimeSyncSupported)
TimingProviderfalse is provided
for isTimeSyncSupported, the cluster offset is set to 0.initialize in interface TimingProviderpublic boolean isTimeSyncSupported()
TimingProviderisTimeSyncSupported in interface TimingProvidertrue if time sync is supported otherwise falsepublic long convertToClusterTime(long timestamp)
TimingProviderconvertToClusterTime in interface TimingProvidertimestamp - Timestamp in local time