Package org.oscim.utils.async
Class AsyncExecutor
java.lang.Object
org.oscim.utils.async.AsyncExecutor
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncExecutor(int maxConcurrent, TaskQueue mainloop) Creates a new AsynchExecutor that allows maxConcurrentRunnableinstances to run in parallel. -
Method Summary
-
Constructor Details
-
AsyncExecutor
Creates a new AsynchExecutor that allows maxConcurrentRunnableinstances to run in parallel.- Parameters:
maxConcurrent- number of threads.
-
-
Method Details
-
post
Submits aRunnableto be executed asynchronously. If maxConcurrent runnables are already running, the runnable will be queued.- Parameters:
task- the task to execute asynchronously
-
dispose
public void dispose()Waits for runningAsyncTaskinstances to finish, then destroys any resources like threads. Can not be used after this method is called.
-