Package org.jboss.util.threadpool
Class BasicThreadPool.TimeoutInfo
- java.lang.Object
-
- org.jboss.util.threadpool.BasicThreadPool.TimeoutInfo
-
- All Implemented Interfaces:
java.lang.Comparable
- Enclosing class:
- BasicThreadPool
private static class BasicThreadPool.TimeoutInfo extends java.lang.Object implements java.lang.Comparable
An encapsulation of a task and its completion timeout
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
firstStop
(package private) long
start
(package private) long
timeoutMS
(package private) TaskWrapper
wrapper
-
Constructor Summary
Constructors Constructor Description TimeoutInfo(TaskWrapper wrapper, long timeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(java.lang.Object o)
Order TimeoutInfo based on the timestamp at which the task needs to be completed by.long
getTaskCompletionTimeout()
long
getTaskCompletionTimeout(long now)
Get the time remaining to the complete timeout timestamp in MS.(package private) TaskWrapper
getTaskWrapper()
void
setTimeout(long timeout)
boolean
stopTask()
Invoke stopTask on the wrapper and indicate whether this was the first time the task has been notified to stop.
-
-
-
Field Detail
-
start
long start
-
timeoutMS
long timeoutMS
-
wrapper
TaskWrapper wrapper
-
firstStop
boolean firstStop
-
-
Constructor Detail
-
TimeoutInfo
TimeoutInfo(TaskWrapper wrapper, long timeout)
-
-
Method Detail
-
setTimeout
public void setTimeout(long timeout)
-
compareTo
public int compareTo(java.lang.Object o)
Order TimeoutInfo based on the timestamp at which the task needs to be completed by.- Specified by:
compareTo
in interfacejava.lang.Comparable
- Parameters:
o
- a TimeoutInfo- Returns:
- the diff between this timeoutMS and the argument timeoutMS
-
getTaskWrapper
TaskWrapper getTaskWrapper()
-
getTaskCompletionTimeout
public long getTaskCompletionTimeout()
-
getTaskCompletionTimeout
public long getTaskCompletionTimeout(long now)
Get the time remaining to the complete timeout timestamp in MS.- Parameters:
now
- - the current System.currentTimeMillis value- Returns:
- the time remaining to the complete timeout timestamp in MS.
-
stopTask
public boolean stopTask()
Invoke stopTask on the wrapper and indicate whether this was the first time the task has been notified to stop.- Returns:
- true if this is the first stopTask, false on the second.
-
-