Methods Summary |
---|
private synchronized void | decrementClock()
_timeLeftUntilWeShrinkThePool -= DEFAULT_TIME_INTERVAL;
if (0 > _timeLeftUntilWeShrinkThePool) {
_timeLeftUntilWeShrinkThePool = 0;
}
|
public synchronized void | pause()
_paused = true;
|
private synchronized void | resetClock()
_timeLeftUntilWeShrinkThePool = DEFAULT_TIME_TO_WAIT;
|
public synchronized void | resume()
_timeLeftUntilWeShrinkThePool = DEFAULT_TIME_TO_WAIT;
_paused = false;
|
public void | run()
while (true) {
try {
Thread.sleep(DEFAULT_TIME_INTERVAL);
} catch (InterruptedException e) {/* ignored*/
}
if (!_paused) {
decrementClock();
if (0 == _timeLeftUntilWeShrinkThePool) {
_owner.removeAnObject();
resetClock();
}
}
}
|