Package org.greenrobot.eventbus.util
Class AsyncExecutor
- java.lang.Object
-
- org.greenrobot.eventbus.util.AsyncExecutor
-
public class AsyncExecutor extends java.lang.Object
Executes anAsyncExecutor.RunnableEx
using a thread pool. Thrown exceptions are propagated by posting failure events. By default, usesThrowableFailureEvent
.Set a custom event type using
AsyncExecutor.Builder.failureEventType(Class)
. The failure event class must have a constructor with one parameter of typeThrowable
. If using ProGuard or R8 make sure the constructor of the failure event class is kept, it is accessed via reflection. E.g. add a rule like-keepclassmembers class com.example.CustomThrowableFailureEvent { <init>(java.lang.Throwable); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AsyncExecutor.Builder
static interface
AsyncExecutor.RunnableEx
LikeRunnable
, but the run method may throw an exception.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AsyncExecutor.Builder
builder()
static AsyncExecutor
create()
void
execute(AsyncExecutor.RunnableEx runnable)
Posts an failure event if the givenAsyncExecutor.RunnableEx
throws an Exception.
-
-
-
Method Detail
-
builder
public static AsyncExecutor.Builder builder()
-
create
public static AsyncExecutor create()
-
execute
public void execute(AsyncExecutor.RunnableEx runnable)
Posts an failure event if the givenAsyncExecutor.RunnableEx
throws an Exception.
-
-