uk.ac.ic.doc.automed.p2p.communication
Class UDPServer
java.lang.Object
uk.ac.ic.doc.automed.p2p.communication.AbstractServer
uk.ac.ic.doc.automed.p2p.communication.UDPServer
- All Implemented Interfaces:
- Threadable
- Direct Known Subclasses:
- MulticastServer
public class UDPServer
- extends AbstractServer
|
Constructor Summary |
UDPServer(int serverPort,
RequestListener handler,
int timeOut,
int numWorkers,
int bufferSize)
Creates a new instance of UDPServer |
|
Method Summary |
void |
handleAction()
Handle actions |
protected void |
init()
Initialises the UDP server socket and a JobHandler queue to handle
messages received by this socket. |
protected void |
initQueue()
Create a QueueWorker taking this instance as a job handler. |
void |
runAction()
Implements the runnable action |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serverSocket
protected java.net.DatagramSocket serverSocket
msgQueue
protected Queue msgQueue
jHandler
protected JobHandler jHandler
UDPServer
public UDPServer(int serverPort,
RequestListener handler,
int timeOut,
int numWorkers,
int bufferSize)
throws CommunicationException
- Creates a new instance of UDPServer
- Throws:
CommunicationException
init
protected void init()
throws CommunicationException
- Initialises the UDP server socket and a
JobHandler queue to handle
messages received by this socket.
- Throws:
CommunicationException
initQueue
protected void initQueue()
- Create a
QueueWorker taking this instance as a job handler. Then create
a number of daemon threads having this worker as the handler.
runAction
public void runAction()
throws AutoMedException
- Implements the runnable action
- Specified by:
runAction in interface Threadable- Specified by:
runAction in class AbstractServer
- Throws:
AutoMedException
handleAction
public void handleAction()
- Handle actions
- Specified by:
handleAction in interface Threadable- Specified by:
handleAction in class AbstractServer