public interface Reactor
Modifier and Type | Method and Description |
---|---|
void |
addPollable(Pollable pollable,
LoopHandler handler)
Add a new Pollable to this Reactor.
|
void |
addTimer(long initialDelay,
int numIterations,
LoopHandler handler)
Add a new ReactorTimer to this Reactor.
|
void |
cancel(LoopHandler handler)
Cancel an existing Pollable or ReactorTimer and remove the corresponding
LoopHandler from executing.
|
void |
start()
Start the reactor.
|
void |
stop()
Stop the reactor.
|
void start()
void stop()
void addPollable(Pollable pollable, LoopHandler handler)
This method is not thread-safe, and should only be done from inside the LoopHandler when invoked by the Reactor on its own thread.
pollable
- The Pollable with the socket to pollhandler
- The loop handlervoid addTimer(long initialDelay, int numIterations, LoopHandler handler)
This method is not thread-safe, and should only be done from inside the LoopHandler when invoked by the Reactor on its own thread.
initialDelay
- The initial delay, in millisecondsnumIterations
- The number of iterations, after which this timer stophandler
- The loop handlervoid cancel(LoopHandler handler)
This method is not thread-safe, and should only be done from inside the LoopHandler when invoked by the Reactor on its own thread.
handler
- The loop handlerCopyright © 2019. All rights reserved.