|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.services.util.Waiter
public class Waiter
Waiter class. This is used in conjunction with WaitPolicy
.
Typical use is for the application which needs to follow a WaitPolicy to construct a Waiter
and if the resource in question is not available call sleep()
until it is or sleep()
returns false.
Constructor Summary | |
---|---|
Waiter(WaitPolicy waitPolicy)
Constructs a Waiter from a WaitPolicy . |
Method Summary | |
---|---|
long |
getTotalTimeWaited()
Returns the total time spent waiting at the time of this method call. |
boolean |
sleep()
Sleep as dictated by the policy. |
Constructor Detail |
---|
public Waiter(WaitPolicy waitPolicy)
WaitPolicy
. After the constructor returns the
WaitPolicy object is no longer needed.
waitPolicy
- Method Detail |
---|
public boolean sleep() throws java.lang.InterruptedException
In the discussion that follows the variables referred to use the names of the parameters
of WaitPolicy.WaitPolicy(TYPE, int, int, int, int, long)
.
initialWait sets the time for the first sleep. waitIncrement can be either positive or
negative and subsequent sleep periods are adjusted by waitIncrement, subject to the
bounds imposed by minimumWait and maximumWait. If the WaitPolicy is of type
WaitPolicy.TYPE.FINITE
then the final sleep period is adjusted so that
totalWait is not exceeded.
Do note the various times determine how long the method sleeps and no attempt is made to adjust for time spent performing other operations.
WaitPolicy.TYPE.NONE
java.lang.InterruptedException
- if the call to Thread.sleep() which is used to implement
"sleep" throws an InterruptedException.public long getTotalTimeWaited()
|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |