org.jtoolkit.essence.concurrency
Class Timeout
java.lang.Object
org.jtoolkit.essence.concurrency.Timeout
public class Timeout
- extends java.lang.Object
A standardised timeout with a fixed end time. Using the same timeout ensures all operation stop at a given future time.
- Author:
- Peter Lawrey
|
Constructor Summary |
Timeout(long timeoutMS)
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
NEVER
public static final Timeout NEVER
ALWAYS
public static final Timeout ALWAYS
NEVER_STR
public static final java.lang.String NEVER_STR
- See Also:
- Constant Field Values
Timeout
public Timeout(long timeoutMS)
parse
public static Timeout parse(java.lang.String serverTimeOutStr)
throws java.lang.IllegalArgumentException
- Derive a timeout fronm a string. Either the time is "never" or "" which means never or a delay in milliseconds.
- Throws:
java.lang.IllegalArgumentException
isNever
public boolean isNever()
hasNotTimedOut
public boolean hasNotTimedOut()
getMillisLeft
public long getMillisLeft()
join
public void join(@NotNull
java.lang.Thread thread)
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode in class java.lang.Object
or
public Timeout or(Timeout timeout)
Copyright © Peter Lawrey. All Rights Reserved.