|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.plugin.util.Timeout
public class Timeout
Used to calculate elapsed time for timeouts from when it is created when successively calling blocking methods. Always converts to nanoseconds.
Usage:
Timeout timeout = Timeout.getNanosTimeout(1, TimeUnit.SECONDS); String str = futureString.get(timeout.getTime(), timeout.getUnit()); Integer num = futureInt.get(timeout.getTime(), timeout.getUnit());where if the first call takes quarter of a second, the second call is passed the equivalent of three-quarters of a second.
| Method Summary | |
|---|---|
static Timeout |
getMillisTimeout(long time,
java.util.concurrent.TimeUnit unit)
Get a Timeout that uses millisecond precision. |
static Timeout |
getNanosTimeout(long time,
java.util.concurrent.TimeUnit unit)
Get a Timeout that uses nanosecond precision. |
java.lang.String |
getRemaining()
|
long |
getTime()
|
java.util.concurrent.TimeUnit |
getUnit()
|
boolean |
isExpired()
Has this timeout expired |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Timeout getNanosTimeout(long time,
java.util.concurrent.TimeUnit unit)
Timeout that uses nanosecond precision. The accuracy will depend on the
accuracy of System.nanoTime().
time - the maximum time to wait for the lockunit - the time unit of the time argument.
TimeUnit.NANOSECONDS precision.
public static Timeout getMillisTimeout(long time,
java.util.concurrent.TimeUnit unit)
Timeout that uses millisecond precision.
time - the maximum time to wait for the lockunit - the time unit of the time argument.
TimeUnit.MILLISECONDS precision.public long getTime()
public java.util.concurrent.TimeUnit getUnit()
public java.lang.String getRemaining()
public boolean isExpired()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||