Package jadex.commons.future
Class ThreadSuspendable
- java.lang.Object
 - 
- jadex.commons.future.ThreadLocalTransferHelper
 - 
- jadex.commons.future.ThreadSuspendable
 
 
 
- 
- All Implemented Interfaces:
 ISuspendable
public class ThreadSuspendable extends ThreadLocalTransferHelper implements ISuspendable
Suspendable for threads. 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected IFuture<?>futureThe future.protected booleanresumedThe resumed flag to differentiante from timeout.- 
Fields inherited from class jadex.commons.future.ThreadLocalTransferHelper
THREADLOCALS, vals 
- 
Fields inherited from interface jadex.commons.future.ISuspendable
SUSPENDABLE 
 - 
 
- 
Constructor Summary
Constructors Constructor Description ThreadSuspendable() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longgetDefaultTimeout()Get the default timeout.java.lang.ObjectgetMonitor()Get the monitor for waiting.voidresume(Future<?> future)Resume the execution of the suspendable.voidsuspend(Future<?> future, long timeout, boolean realtime)Suspend the execution of the suspendable.- 
Methods inherited from class jadex.commons.future.ThreadLocalTransferHelper
addThreadLocal, afterSwitch, beforeSwitch, removeThreadLocal, restoreValues, saveValues 
 - 
 
 - 
 
- 
- 
Field Detail
- 
future
protected IFuture<?> future
The future. 
- 
resumed
protected boolean resumed
The resumed flag to differentiante from timeout. 
 - 
 
- 
Method Detail
- 
suspend
public void suspend(Future<?> future, long timeout, boolean realtime)
Suspend the execution of the suspendable.- Specified by:
 suspendin interfaceISuspendable- Parameters:
 timeout- The timeout.realtime- Flag if timeout is realtime (in contrast to simulation time).future- The future to wait for.
 
- 
resume
public void resume(Future<?> future)
Resume the execution of the suspendable.- Specified by:
 resumein interfaceISuspendable- Parameters:
 future- The future that issues the resume.
 
- 
getMonitor
public java.lang.Object getMonitor()
Get the monitor for waiting.- Specified by:
 getMonitorin interfaceISuspendable- Returns:
 - The monitor.
 
 
- 
getDefaultTimeout
protected long getDefaultTimeout()
Get the default timeout.- Returns:
 - The default timeout (-1 for none).
 
 
 - 
 
 -