The dispatcher uses the following thread model: Incoming packets for all the registered endpoints are received in the thread that executes the {@link #run()} method. For everypacket received, a {@link ProcessPacketTask} instance is createdand dispatched to a worker thread from the configured pool.
The methods {@link #addEndpoint(Endpoint)}, {@link #removeEndpoint(Endpoint)}and {@link #stop()} are thread safe and may be called from any thread.However, to avoid concurrency issues, the operation on the underlying {@link Selector} will always be executed by the thread executing the{@link #run()} method. The three methods mentioned above will block untilthe operation has completed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|