Package jadex.commons.future
Class ThreadLocalTransferHelper
- java.lang.Object
- 
- jadex.commons.future.ThreadLocalTransferHelper
 
- 
- Direct Known Subclasses:
- ComponentSuspendable,- ThreadSuspendable
 
 public class ThreadLocalTransferHelper extends java.lang.ObjectHelps to transfer registered thread local values between different threads.
- 
- 
Field SummaryFields Modifier and Type Field Description protected static java.util.Set<java.lang.ThreadLocal<java.lang.Object>>THREADLOCALSThe registered thread locals.protected java.util.Map<java.lang.ThreadLocal<java.lang.Object>,java.lang.Object>valsThe thread locals.
 - 
Constructor SummaryConstructors Constructor Description ThreadLocalTransferHelper()Create a new transfer helper.ThreadLocalTransferHelper(boolean beforeswitch)Create a new transfer helper.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddThreadLocal(java.lang.ThreadLocal<?> tl)Add a thread local that will be automatically copied on thread resumption.voidafterSwitch()Must be called after a thread switch occurs to restore the thread local values.voidbeforeSwitch()Must be called before a thread switch occurs to save the thread local values.static voidremoveThreadLocal(java.lang.ThreadLocal<?> tl)Add a thread local that will be automatically copied on thread resumption.static voidrestoreValues(java.util.Map<java.lang.ThreadLocal<java.lang.Object>,java.lang.Object> vals)Method to be called on new thread on resumption.static java.util.Map<java.lang.ThreadLocal<java.lang.Object>,java.lang.Object>saveValues()Method to be called on old thread before thread switch.
 
- 
- 
- 
Method Detail- 
saveValuespublic static java.util.Map<java.lang.ThreadLocal<java.lang.Object>,java.lang.Object> saveValues() Method to be called on old thread before thread switch.
 - 
restoreValuespublic static void restoreValues(java.util.Map<java.lang.ThreadLocal<java.lang.Object>,java.lang.Object> vals) Method to be called on new thread on resumption.
 - 
addThreadLocalpublic static void addThreadLocal(java.lang.ThreadLocal<?> tl) Add a thread local that will be automatically copied on thread resumption.
 - 
removeThreadLocalpublic static void removeThreadLocal(java.lang.ThreadLocal<?> tl) Add a thread local that will be automatically copied on thread resumption.
 - 
beforeSwitchpublic void beforeSwitch() Must be called before a thread switch occurs to save the thread local values.
 - 
afterSwitchpublic void afterSwitch() Must be called after a thread switch occurs to restore the thread local values.
 
- 
 
-