public final class ReactorDispatcher extends Object
Reactor is not thread-safe - all calls to Proton API's should be - on the Reactor Thread.
Reactor works out-of-box for all event driven API - ex: onReceive - which could raise upon onSocketRead.
Reactor didn't support API's like Send() out-of-box - which could potentially run on different thread to that of Reactor.
So, the following utility class is used to generate an Event to hook into Reactor's event delegation pattern.
It uses a Pipe as the IO on which Reactor Listens to.
Cardinality: multiple ReactorDispatcher's could be attached to 1 Reactor.
Each ReactorDispatcher should be initialized Synchronously - as it calls API in Reactor which is not thread-safe.| Constructor and Description |
|---|
ReactorDispatcher(org.apache.qpid.proton.reactor.Reactor reactor) |
| Modifier and Type | Method and Description |
|---|---|
void |
invoke(DispatchHandler timerCallback) |
void |
invoke(int delay,
DispatchHandler timerCallback) |
public ReactorDispatcher(org.apache.qpid.proton.reactor.Reactor reactor)
throws IOException
IOExceptionpublic void invoke(DispatchHandler timerCallback) throws IOException, RejectedExecutionException
public void invoke(int delay,
DispatchHandler timerCallback)
throws IOException,
RejectedExecutionException
Copyright © 2019. All rights reserved.