Package org.graylog.scheduler.clock
Class JobSchedulerSystemClock
java.lang.Object
org.graylog.scheduler.clock.JobSchedulerSystemClock
- All Implemented Interfaces:
JobSchedulerClock
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the current java.time.Instant.Returns the current time for the give time zone.org.joda.time.DateTime
now
(org.joda.time.DateTimeZone zone) Returns the current time for the give time zone.org.joda.time.DateTime
nowUTC()
Returns the current UTC time.void
Causes the current execution thread to sleep for the given duration.void
sleepUninterruptibly
(long duration, TimeUnit unit) Causes the current execution thread to sleep uninterruptibly for the given duration.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
JobSchedulerSystemClock
public JobSchedulerSystemClock()
-
-
Method Details
-
nowUTC
public org.joda.time.DateTime nowUTC()Returns the current UTC time.- Specified by:
nowUTC
in interfaceJobSchedulerClock
- Returns:
- current time
-
instantNow
Returns the current java.time.Instant.- Specified by:
instantNow
in interfaceJobSchedulerClock
- Returns:
- current time as
Instant
-
now
public org.joda.time.DateTime now(org.joda.time.DateTimeZone zone) Returns the current time for the give time zone.- Specified by:
now
in interfaceJobSchedulerClock
- Returns:
- current time
-
now
Returns the current time for the give time zone.- Specified by:
now
in interfaceJobSchedulerClock
- Returns:
- current time
-
sleep
Causes the current execution thread to sleep for the given duration.- Specified by:
sleep
in interfaceJobSchedulerClock
- Parameters:
duration
- duration valueunit
- duration unit- Throws:
InterruptedException
-
sleepUninterruptibly
Description copied from interface:JobSchedulerClock
Causes the current execution thread to sleep uninterruptibly for the given duration.- Specified by:
sleepUninterruptibly
in interfaceJobSchedulerClock
- Parameters:
duration
- duration valueunit
- duration unit
-