@InterfaceAudience.Private public class Sleeper extends Object
Modifier and Type | Field and Description |
---|---|
private static org.apache.commons.logging.Log |
LOG |
private static long |
MINIMAL_DELTA_FOR_LOGGING |
private int |
period |
private Object |
sleepLock |
private Stoppable |
stopper |
private boolean |
triggerWake |
Modifier and Type | Method and Description |
---|---|
int |
getPeriod() |
void |
skipSleepCycle()
If currently asleep, stops sleeping; if not asleep, will skip the next
sleep cycle.
|
void |
sleep()
Sleep for period.
|
void |
sleep(long startTime)
Sleep for period adjusted by passed
startTime |
private static final org.apache.commons.logging.Log LOG
private final int period
private final Stoppable stopper
private static final long MINIMAL_DELTA_FOR_LOGGING
private final Object sleepLock
private boolean triggerWake
public Sleeper(int sleep, Stoppable stopper)
sleep
- sleep time in millisecondsstopper
- When Stoppable.isStopped()
is true, this thread will
cleanup and exit cleanly.public void sleep()
public void skipSleepCycle()
public void sleep(long startTime)
startTime
startTime
- Time some task started previous to now. Time to sleep
will be docked current time minus passed startTime
.public final int getPeriod()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.