public class FiberStub extends Object implements Fiber
Modifier and Type | Class and Description |
---|---|
static class |
FiberStub.ScheduledEvent |
Modifier and Type | Field and Description |
---|---|
List<Disposable> |
Disposables |
List<Runnable> |
Pending |
List<FiberStub.ScheduledEvent> |
Scheduled |
Constructor and Description |
---|
FiberStub() |
Modifier and Type | Method and Description |
---|---|
void |
add(Disposable disposable)
Add a
Disposable to be disposed when this component is disposed |
void |
dispose()
Dispose this instance.
|
void |
execute(Runnable command) |
void |
executeAllPending() |
void |
executeAllScheduled() |
boolean |
remove(Disposable disposable)
Remove a
Disposable from being disposed when this component is disposed |
Disposable |
schedule(Runnable runnable,
long l,
TimeUnit timeUnit)
Creates and executes a one-shot action that becomes enabled after the given delay.
|
Disposable |
scheduleAtFixedRate(Runnable runnable,
long first,
long interval,
TimeUnit timeUnit)
Creates and executes a periodic action that becomes enabled first after the given initial delay,
and subsequently with the given period; that is executions will commence after initialDelay
then initialDelay+period, then initialDelay + 2 * period, and so on.
|
Disposable |
scheduleWithFixedDelay(Runnable command,
long initialDelay,
long delay,
TimeUnit unit)
Creates and executes a periodic action that becomes enabled first
after the given initial delay, and subsequently with the
given delay between the termination of one execution and the
commencement of the next.
|
int |
size()
Return the number of
Disposable instances registered with this instance. |
void |
start()
Start consuming events
|
public List<Disposable> Disposables
public List<FiberStub.ScheduledEvent> Scheduled
public void start()
Fiber
public void add(Disposable disposable)
DisposingExecutor
Disposable
to be disposed when this component is disposedadd
in interface DisposingExecutor
disposable
- Disposable instance. Should not be null.public boolean remove(Disposable disposable)
DisposingExecutor
Disposable
from being disposed when this component is disposedremove
in interface DisposingExecutor
disposable
- Disposable instance. Should not be nullpublic int size()
DisposingExecutor
Disposable
instances registered with this instance.
This method is typically used for testing and debugging purposes.size
in interface DisposingExecutor
Disposable
instances registered.public Disposable schedule(Runnable runnable, long l, TimeUnit timeUnit)
Scheduler
public Disposable scheduleAtFixedRate(Runnable runnable, long first, long interval, TimeUnit timeUnit)
Scheduler
scheduleAtFixedRate
in interface Scheduler
runnable
- the task to executefirst
- the time to delay first executioninterval
- the delaytimeUnit
- the time unit of the initialDelay and delay parameterspublic Disposable scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
Scheduler
scheduleWithFixedDelay
in interface Scheduler
command
- the task to executeinitialDelay
- the time to delay first executiondelay
- the delay between the termination of one
execution and the commencement of the nextunit
- the time unit of the initialDelay and delay parameterspublic void dispose()
Disposable
dispose
in interface Disposable
public void executeAllPending()
public void executeAllScheduled()
Copyright © 2017. All Rights Reserved.