Package com.badlogic.gdx.utils.async
Class AsyncExecutor
- java.lang.Object
-
- com.badlogic.gdx.utils.async.AsyncExecutor
-
- All Implemented Interfaces:
Disposable
public class AsyncExecutor extends java.lang.Object implements Disposable
-
-
Constructor Summary
Constructors Constructor Description AsyncExecutor(int maxConcurrent)
Creates a new AsynchExecutor with the name "AsynchExecutor-Thread".AsyncExecutor(int maxConcurrent, java.lang.String name)
Creates a new AsynchExecutor that allows maxConcurrentRunnable
instances to run in parallel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Waits for runningAsyncTask
instances to finish, then destroys any resources like threads.<T> AsyncResult<T>
submit(AsyncTask<T> task)
Submits aRunnable
to be executed asynchronously.
-
-
-
Constructor Detail
-
AsyncExecutor
public AsyncExecutor(int maxConcurrent)
Creates a new AsynchExecutor with the name "AsynchExecutor-Thread".
-
AsyncExecutor
public AsyncExecutor(int maxConcurrent, java.lang.String name)
Creates a new AsynchExecutor that allows maxConcurrentRunnable
instances to run in parallel.- Parameters:
maxConcurrent
-name
- The name of the threads.
-
-
Method Detail
-
submit
public <T> AsyncResult<T> submit(AsyncTask<T> task)
Submits aRunnable
to 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 runningAsyncTask
instances to finish, then destroys any resources like threads. Can not be used after this method is called.- Specified by:
dispose
in interfaceDisposable
-
-