protected static class RpcEndpoint.MainThreadExecutor extends Object implements ComponentMainThreadExecutor
ComponentMainThreadExecutor.DummyComponentMainThreadExecutor
Modifier and Type | Method and Description |
---|---|
void |
assertRunningInMainThread()
Returns true if the method was called in the thread of this executor.
|
void |
execute(Runnable command) |
void |
runAsync(Runnable runnable) |
<V> ScheduledFuture<V> |
schedule(Callable<V> callable,
long delay,
TimeUnit unit)
Executes the given callable after the given delay.
|
ScheduledFuture<?> |
schedule(Runnable command,
long delay,
TimeUnit unit)
Executes the given command after the given delay.
|
ScheduledFuture<?> |
scheduleAtFixedRate(Runnable command,
long initialDelay,
long period,
TimeUnit unit)
Executes the given command periodically.
|
void |
scheduleRunAsync(Runnable runnable,
long delayMillis) |
ScheduledFuture<?> |
scheduleWithFixedDelay(Runnable command,
long initialDelay,
long delay,
TimeUnit unit)
Executed the given command repeatedly with the given delay between the end of an execution
and the start of the next execution.
|
public void runAsync(Runnable runnable)
public void scheduleRunAsync(Runnable runnable, long delayMillis)
public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
ScheduledExecutor
schedule
in interface ScheduledExecutor
command
- the task to execute in the futuredelay
- the time from now to delay the executionunit
- the time unit of the delay parameterpublic <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit)
ScheduledExecutor
ScheduledFuture
.schedule
in interface ScheduledExecutor
V
- result type of the callablecallable
- the callable to executedelay
- the time from now to delay the executionunit
- the time unit of the delay parameterpublic ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
ScheduledExecutor
initialDelay
, the second execution is started after initialDelay + period
, the third
after initialDelay + 2*period
and so on. The task is executed until either an
execution fails, or the returned ScheduledFuture
is cancelled.scheduleAtFixedRate
in interface ScheduledExecutor
command
- the task to be executed periodicallyinitialDelay
- the time from now until the first execution is triggeredperiod
- the time after which the next execution is triggeredunit
- the time unit of the delay and period parameterpublic ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
ScheduledExecutor
ScheduledFuture
is cancelled.scheduleWithFixedDelay
in interface ScheduledExecutor
command
- the task to execute repeatedlyinitialDelay
- the time from now until the first execution is triggereddelay
- the time between the end of the current and the start of the next executionunit
- the time unit of the initial delay and the delay parameterpublic void assertRunningInMainThread()
ComponentMainThreadExecutor
assertRunningInMainThread
in interface ComponentMainThreadExecutor
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.