|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgr.uoa.di.madgik.grs.utils.ProgressiveTimeoutGenerator
public class ProgressiveTimeoutGenerator
Utility class which progressively returns waiting values whose sum amounts to a supplied timeout. Used by readers and writers in order to avoid waiting at once for the full timeout interval when their wait condition is triggered.
| Constructor Summary | |
|---|---|
ProgressiveTimeoutGenerator(long timeout)
Creates a new instance |
|
| Method Summary | |
|---|---|
boolean |
hasNext()
Determines if there are more waiting steps for which a timeout value can be fetched |
long |
next()
Returns the next timeout value based on the time fractions set. |
void |
setFractions(float[] fractions)
Sets time fractions for each step. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ProgressiveTimeoutGenerator(long timeout)
timeout - The total time to wait| Method Detail |
|---|
public void setFractions(float[] fractions)
throws java.lang.Exception
fractions - The fraction of the time to wait at each step.
java.lang.Exception - If the next() or hasNext() method has already been calledpublic long next()
public boolean hasNext()
next(), false otherwise
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||