Package com.couchbase.lite.internal
Class AndroidExecutionService
- java.lang.Object
-
- com.couchbase.lite.internal.exec.AbstractExecutionService
-
- com.couchbase.lite.internal.AndroidExecutionService
-
- All Implemented Interfaces:
ExecutionService
public final class AndroidExecutionService extends AbstractExecutionService
ExecutionService for Android.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.couchbase.lite.internal.exec.ExecutionService
ExecutionService.Cancellable, ExecutionService.CloseableExecutor
-
-
Constructor Summary
Constructors Constructor Description AndroidExecutionService()
AndroidExecutionService(ThreadPoolExecutor executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Executor
getDefaultExecutor()
Get the main executor.ExecutionService.Cancellable
postDelayedOnExecutor(long delayMs, Executor executor, Runnable task)
This runs a task on Android's main thread for just long enough to enough to enqueue the passed task on the passed executor.-
Methods inherited from class com.couchbase.lite.internal.exec.AbstractExecutionService
cancelDelayedTask, dumpState, dumpThreads, getConcurrentExecutor, getSerialExecutor, throttled
-
-
-
-
Constructor Detail
-
AndroidExecutionService
public AndroidExecutionService()
-
AndroidExecutionService
public AndroidExecutionService(@NonNull ThreadPoolExecutor executor)
-
-
Method Detail
-
getDefaultExecutor
@NonNull public Executor getDefaultExecutor()
Description copied from interface:ExecutionService
Get the main executor. It is guaranteed to be a single thread. Suitable for any task that doesn't take a long time to complete.- Returns:
- the main executor.
-
postDelayedOnExecutor
@NonNull public ExecutionService.Cancellable postDelayedOnExecutor(long delayMs, @NonNull Executor executor, @NonNull Runnable task)
This runs a task on Android's main thread for just long enough to enough to enqueue the passed task on the passed executor. It occupies space in the main looper's message queue but takes no significant time processing, there. If the target executor refuses the task, it is just dropped on the floor.- Parameters:
delayMs
- delay before posting the task. There may be additional queue delays in the executor.executor
- an executor on which to execute the task.task
- the task to be executed.- Returns:
- a cancellable task
-
-