|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.axis2.transport.udp.IODispatcher
public class IODispatcher
I/O dispatcher for incoming UDP packets.
This class is responsible for receiving UDP packets and dispatch
the processing of these packets to worker threads.
It uses a Selector
to receive packets from multiple endpoints
and a WorkerPool
to 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.
The methods addEndpoint(Endpoint)
, #removeEndpoint(String)
and 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 Summary | |
---|---|
IODispatcher(DatagramDispatcherCallback callback)
Constructor. |
Method Summary | |
---|---|
void |
addEndpoint(Endpoint endpoint)
Add a new endpoint. |
void |
removeEndpoint(Endpoint endpoint)
Remove an endpoint. |
void |
run()
Run the I/O dispatcher. |
void |
stop()
Stop the dispatcher. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IODispatcher(DatagramDispatcherCallback callback) throws java.io.IOException
callback
-
java.io.IOException
- if the Selector
instance could not be createdMethod Detail |
---|
public void addEndpoint(Endpoint endpoint) throws java.io.IOException
addEndpoint
in interface DatagramDispatcher<Endpoint>
endpoint
- the endpoint description
java.io.IOException
- if the socket could not be created or
registered with the selectorpublic void removeEndpoint(Endpoint endpoint) throws java.io.IOException
removeEndpoint
in interface DatagramDispatcher<Endpoint>
endpoint
- the endpoint description
java.io.IOException
- if an error occurred when closing the socketpublic void stop() throws java.io.IOException
run()
method to stop.
stop
in interface DatagramDispatcher<Endpoint>
java.io.IOException
public void run()
stop()
is called.
run
in interface java.lang.Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |