com.croftsoft.core.util.loop
Class SamplerLoopGovernor
java.lang.Object
com.croftsoft.core.util.loop.SamplerLoopGovernor
- All Implemented Interfaces:
- LoopGovernor
public final class SamplerLoopGovernor
- extends Object
- implements LoopGovernor
Sets the delay by sampling the calling frequency over time.
- Since:
- 2002-03-13
- Version:
- 2003-05-22
- Author:
- David Wallace Croft
Method Summary |
void |
govern()
This method puts the Thread to sleep for a limited time. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_SAMPLE_PERIOD_NANOS
public static final long DEFAULT_SAMPLE_PERIOD_NANOS
- See Also:
- Constant Field Values
DEFAULT_AVERAGING_SAMPLES_MAX
public static final long DEFAULT_AVERAGING_SAMPLES_MAX
- See Also:
- Constant Field Values
SamplerLoopGovernor
public SamplerLoopGovernor(double frequency,
long samplePeriodNanos,
long averagingSamplesMax,
Clock clock)
- Constructs a LoopGovernor with the specified target frequency.
- Parameters:
frequency
- The targeted loop frequency in loops per second.
SamplerLoopGovernor
public SamplerLoopGovernor(double frequency,
Clock clock)
SamplerLoopGovernor
public SamplerLoopGovernor(double frequency)
govern
public void govern()
throws InterruptedException
- Description copied from interface:
LoopGovernor
- This method puts the Thread to sleep for a limited time.
- Specified by:
govern
in interface LoopGovernor
- Throws:
InterruptedException
CroftSoft Core Javadoc (2008-09-28 20:58:02)