public abstract class DiskInputSimulator extends AbstractLoadSimulator
LoadSimulator that simulates disk input.
Disk input is simulated by reading an amount of bytes from a file.| Modifier and Type | Method and Description |
|---|---|
void |
simulateLoad(long load)
Simulates the specified system load.
|
boolean |
waitConditionFulfilled()
Represents the 'wait' condition of an
AbstractLoadSimulator. |
decreaseLoad, getLoad, getMaximumLoad, increaseLoad, isMaximumLoad, isZeroLoad, run, setLoadpublic void simulateLoad(long load)
throws InterruptedException
AbstractLoadSimulatorActual system load simulation happens inside this method. However, the simulation logic implemented here should be kept as short and concise as possible as this method is called from within a while loop internally. Therefore, this method should not start any infinite loops, etc.
load - the load to be simulatedInterruptedException - when the thread is interrupted during load simulationpublic boolean waitConditionFulfilled()
AbstractLoadSimulatorAbstractLoadSimulator.
In order to save resources, the thread executing the AbstractLoadSimulator.run()
method should wait when there is nothing to simulate.
Take for example, a simulator which simulates memory. If it has already allocated the desired amount of memory it has nothing more left to do. In this case the corresponding thread should wait until it retrieves new simulation instructions.
This method is responsible for checking if a simulator currently has something to do or not.
Copyright © 2017. All rights reserved.