public interface LoadSimulator extends Runnable
This type simulates some system load when started as a thread. Further, it defines methods for getting and setting as well as increasing and decreasing some load parameter. Implementing classes should use the load parameter, set by those methods, for their simulation logic.
Class AbstractLoadSimulator provides a skeleton implementation of a LoadSimulator.
Subclassing AbstractLoadSimulator is the preferred way for clients to create new
LoadSimulator classes, as it already provides common simulation behavior as well as
synchronization mechanisms.
Runnable,
AbstractLoadSimulator| Modifier and Type | Method and Description |
|---|---|
void |
decreaseLoad(long delta)
Decreases the load of the simulator by
delta. |
long |
getLoad() |
long |
getMaximumLoad() |
void |
increaseLoad(long delta)
Increases the load of the simulator by
delta. |
boolean |
isMaximumLoad() |
boolean |
isZeroLoad() |
void |
run()
Executes the simulation logic.
|
void |
setLoad(long desiredLoad)
Sets the load to be simulated.
|
void run()
LoadSimulator
is responsible should be simulated.
From Runnable.run():
long getLoad()
void setLoad(long desiredLoad)
desiredLoad - the load to be simulatedvoid increaseLoad(long delta)
delta.delta - the amount by which the load will be increasedvoid decreaseLoad(long delta)
delta.delta - the amount by which the load will be decreasedlong getMaximumLoad()
boolean isMaximumLoad()
boolean isZeroLoad()
Copyright © 2017. All rights reserved.