net.grinder.util
Interface Sleeper

All Superinterfaces:
TimeAuthority
All Known Implementing Classes:
SleeperImplementation

public interface Sleeper
extends TimeAuthority

Something that can sleep.

Author:
Philip Aston

Nested Class Summary
static class Sleeper.ShutdownException
          Exception used to indicate that a Sleeper has been shutdown.
 
Method Summary
 void shutdown()
          Shutdown this Sleeper.
 void sleepFlat(long maximumTime)
          Sleep for a time based on the maximumTime parameter.
 void sleepNormal(long meanTime)
          Sleep for a time based on the meanTime parameter.
 void sleepNormal(long meanTime, long sigma)
          Sleep for a random time drawn from a pseudo normal distribution.
 
Methods inherited from interface net.grinder.util.TimeAuthority
getTimeInMilliseconds
 

Method Detail

shutdown

void shutdown()
Shutdown this Sleeper. Once called, all sleep method invocations will throw Sleeper.ShutdownException, including those already sleeping.


sleepNormal

void sleepNormal(long meanTime)
                 throws Sleeper.ShutdownException
Sleep for a time based on the meanTime parameter. The actual time is taken from a pseudo normal distribution. Approximately 99.75% of times will be within (100* limit9975Factor) percent of the meanTime.

Parameters:
meanTime - Mean time.
Throws:
Sleeper.ShutdownException - If this Sleeper has been shutdown.

sleepNormal

void sleepNormal(long meanTime,
                 long sigma)
                 throws Sleeper.ShutdownException
Sleep for a random time drawn from a pseudo normal distribution.

Parameters:
meanTime - Mean time.
sigma - Standard deviation.
Throws:
Sleeper.ShutdownException - If this Sleeper has been shutdown.

sleepFlat

void sleepFlat(long maximumTime)
               throws Sleeper.ShutdownException
Sleep for a time based on the maximumTime parameter. The actual time is taken from a pseudo random flat distribution between 0 and maximumTime.

Parameters:
maximumTime - Maximum time.
Throws:
Sleeper.ShutdownException - If this Sleeper has been shutdown.


Copyright © 2000-2013. All Rights Reserved.