public class IODispatcher extends Object implements DatagramDispatcher<Endpoint>, Runnable
Selectorto receive packets from multiple endpoints and a
WorkerPoolto dispatch the processing tasks.
The dispatcher uses the following thread model:
Incoming packets for all the registered endpoints are received
in the thread that executes the
run() method. For every
packet received, a
ProcessPacketTask instance is created
and dispatched to a worker thread from the configured pool.
stop() are thread safe and may be called from any thread.
However, to avoid concurrency issues, the operation on the underlying
Selector will always be executed by the thread executing the
run() method. The three methods mentioned above will block until
the operation has completed.
|Constructor and Description|
|Modifier and Type||Method and Description|
Add a new endpoint.
Remove an endpoint.
Run the I/O dispatcher.
Stop the dispatcher.
public void addEndpoint(Endpoint endpoint) throws IOException
public void removeEndpoint(Endpoint endpoint) throws IOException
public void stop() throws IOException
run()method to stop.
Copyright © The Apache Software Foundation. All Rights Reserved.