Package jadex.bridge.service.component
Class ComponentSuspendable
- java.lang.Object
 - 
- jadex.commons.future.ThreadLocalTransferHelper
 - 
- jadex.bridge.service.component.ComponentSuspendable
 
 
 
- 
- All Implemented Interfaces:
 ISuspendable
public class ComponentSuspendable extends ThreadLocalTransferHelper implements ISuspendable
Allow waiting for futures by blocking a component. 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected IInternalAccessagentThe component adapter.static java.lang.ThreadLocal<ComponentSuspendable>COMSUPSThe component suspendables.protected Future<?>futureThe current future.protected java.util.Map<java.lang.ThreadLocal<java.lang.Object>,java.lang.Object>valsThe thread locals.- 
Fields inherited from class jadex.commons.future.ThreadLocalTransferHelper
THREADLOCALS 
- 
Fields inherited from interface jadex.commons.future.ISuspendable
SUSPENDABLE 
 - 
 
- 
Constructor Summary
Constructors Constructor Description ComponentSuspendable(IInternalAccess agent)Create a component suspendable. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetDefaultTimeout()Get the default timeout.Future<?>getFuture()Get the future.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.java.lang.StringtoString()Get the string representation.- 
Methods inherited from class jadex.commons.future.ThreadLocalTransferHelper
addThreadLocal, afterSwitch, beforeSwitch, removeThreadLocal, restoreValues, saveValues 
 - 
 
 - 
 
- 
- 
Field Detail
- 
COMSUPS
public static final java.lang.ThreadLocal<ComponentSuspendable> COMSUPS
The component suspendables. 
- 
agent
protected IInternalAccess agent
The component adapter. 
- 
future
protected Future<?> future
The current future. 
- 
vals
protected java.util.Map<java.lang.ThreadLocal<java.lang.Object>,java.lang.Object> vals
The thread locals. 
 - 
 
- 
Constructor Detail
- 
ComponentSuspendable
public ComponentSuspendable(IInternalAccess agent)
Create a component suspendable. 
 - 
 
- 
Method Detail
- 
suspend
public void suspend(Future<?> future, long timeout, boolean realtime)
Suspend the execution of the suspendable.- Specified by:
 suspendin interfaceISuspendable- Parameters:
 future- The future to wait for.timeout- The timeout.realtime- Flag if timeout is realtime (in contrast to simulation time).
 
- 
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.
 
 
- 
getFuture
public Future<?> getFuture()
Get the future.- Returns:
 - The future.
 
 
- 
getDefaultTimeout
public long getDefaultTimeout()
Get the default timeout.- Returns:
 - The default timeout (-1 for none).
 
 
- 
toString
public java.lang.String toString()
Get the string representation.- Overrides:
 toStringin classjava.lang.Object
 
 - 
 
 -