Package org.adempiere.util
Class ContextRunnable
java.lang.Object
org.adempiere.util.ContextRunnable
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
GridTab.Loader
,MLookup.MLoader
,ZkContextRunnable
Base class to implement runnable that will execute code in session context.
Example usage:
Example usage:
ContextRunnable runnable = new ContextRunnable() { protected void doRun() { .... } }; Adempiere.getThreadPoolExecutor().submit(runnable);
- Author:
- hengsin
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
cleanup()
clean up thread local contextprotected abstract void
doRun()
override to execute code in session contextvoid
run()
Set captured session context as current thread local context and calldoRun()
to perform actual work.protected void
setup()
setup thread local context
-
Field Details
-
context
current session context
-
-
Constructor Details
-
ContextRunnable
public ContextRunnable()Capture reference to current session context.
-
-
Method Details
-
run
public void run()Set captured session context as current thread local context and calldoRun()
to perform actual work. -
setup
protected void setup()setup thread local context -
cleanup
protected void cleanup()clean up thread local context -
doRun
protected abstract void doRun()override to execute code in session context
-