public class ThreadUtils
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ThreadUtils.MainThreadRunnable |
static class |
ThreadUtils.PRIORITY |
static class |
ThreadUtils.WorkerThreadRunnable |
| Constructor and Description |
|---|
ThreadUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addTaskToWorkerGroup(java.lang.String serialiseGroup,
ThreadUtils.PRIORITY priority,
ThreadUtils.WorkerThreadRunnable runnable)
Run parallel in background but serialized executed in a group.
|
static void |
postToMainThread(ThreadUtils.MainThreadRunnable runnable)
Run Ui operation on the main thread at the next UI Frame.
|
static void |
replaceTaskOnWorkerGroup(java.lang.String serialiseGroup,
ThreadUtils.PRIORITY priority,
ThreadUtils.WorkerThreadRunnable runnable)
Run parallel in background but executed only one in a group, if exist a previously task it will be removed.
|
static void |
runOnMainThread(ThreadUtils.MainThreadRunnable runnable)
Run Ui operation on the main thread at the next UI Frame
or instant if the execution thread already the main thread.
|
static boolean |
thisIsUiThread()
Check if this is the Ui thread.
|
@WorkerThread
public static void postToMainThread(@NonNull
ThreadUtils.MainThreadRunnable runnable)
runnable - the runnable.public static void runOnMainThread(@NonNull
ThreadUtils.MainThreadRunnable runnable)
runnable - the runnable.public static boolean thisIsUiThread()
public static void addTaskToWorkerGroup(@NonNull
java.lang.String serialiseGroup,
@NonNull
ThreadUtils.PRIORITY priority,
@NonNull
ThreadUtils.WorkerThreadRunnable runnable)
serialiseGroup - group name for serializingpriority - thread priority during runnable execution, this will not change the order in the group, it change the priority of the thread during the runnable execution.runnable - executing runnablepublic static void replaceTaskOnWorkerGroup(@NonNull
java.lang.String serialiseGroup,
@NonNull
ThreadUtils.PRIORITY priority,
@NonNull
ThreadUtils.WorkerThreadRunnable runnable)
serialiseGroup - group name for serializingpriority - thread priority during runnable execution, this will not change the order in the group, it change the priority of the thread during the runnable execution.runnable - executing runnable