Package org.oscim.utils.async
Class SimpleWorker<T>
java.lang.Object
org.oscim.utils.async.SimpleWorker<T>
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
AbstractVectorLayer.Worker
Simple 'Double Buffering' worker for running Tasks on AsyncExecutor
thread.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected final Mapprotected longprotected booleanprotected TStuff that is done an ready for being fetched by poll().protected TStuff that is ready - will not be modified in the worker.protected TStuff which can be processed on the worker thread.protected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel(boolean clear) abstract voidabstract booleanvoidfinish()booleanvoidonMainLoop(T task) do stuff on main-loop before executing the taskpoll()voidrun()voidsubmit(long delay) If delay > 0 onMainLoop will be called before Task is passed to worker-thread
-
Field Details
-
mMap
-
mRunning
protected boolean mRunning -
mWait
protected boolean mWait -
mCancel
protected boolean mCancel -
mDelayed
protected boolean mDelayed -
mMinDelay
protected long mMinDelay -
mTaskTodo
Stuff which can be processed on the worker thread. -
mTaskDone
Stuff that is done an ready for being fetched by poll(). -
mTaskLocked
Stuff that is ready - will not be modified in the worker.
-
-
Constructor Details
-
SimpleWorker
-
-
Method Details
-
run
public void run() -
doWork
-
cleanup
-
finish
public void finish() -
onMainLoop
do stuff on main-loop before executing the task -
submit
public void submit(long delay) If delay > 0 onMainLoop will be called before Task is passed to worker-thread -
poll
-
cancel
public void cancel(boolean clear) -
isRunning
public boolean isRunning()
-