|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
org.sapia.ubik.mcast.server.UDPServer
org.sapia.ubik.mcast.UDPUnicastDispatcher
public class UDPUnicastDispatcher
Implements the UnicastDispatcher interface over UDP.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary |
|---|
| Fields inherited from class org.sapia.ubik.mcast.server.UDPServer |
|---|
_sock |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
UDPUnicastDispatcher(int soTimeout,
EventConsumer consumer)
Constructor for UnicastDispatcherImpl. |
|
UDPUnicastDispatcher(int soTimeout,
int port,
EventConsumer consumer)
Constructor for UnicastDispatcherImpl. |
|
| Method Summary | |
|---|---|
protected int |
bufSize()
|
void |
close()
Closes this instance - which should not be used thereafter. |
void |
dispatch(ServerAddress addr,
java.lang.String type,
java.lang.Object data)
Dispatches the given data to the node whose address is given. |
ServerAddress |
getAddress()
Returns the address of this instance. |
protected void |
handle(java.net.DatagramPacket pack,
java.net.DatagramSocket sock)
|
protected void |
handlePacketSizeToShort(java.net.DatagramPacket pack)
|
protected void |
handleSoTimeout()
|
RespList |
send(java.util.List addresses,
java.lang.String type,
java.lang.Object data)
Sends the given data to the list of destinations specified, and returning the responses received from each destination. |
Response |
send(ServerAddress addr,
java.lang.String type,
java.lang.Object data)
Sends the given data to the node whose address is given, returning the corresponding response - received from the destination. |
void |
setBufsize(int size)
Sets this instance's "buffer size". |
void |
setSoTimeoutListener(SocketTimeoutListener listener)
Allows to set a listener that will be notified when the internal UDP socket used by this instance reaches a timeout. |
void |
start()
Starts this instance - should be called prior to using this instance. |
| Methods inherited from class org.sapia.ubik.mcast.server.UDPServer |
|---|
getPort, run |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public UDPUnicastDispatcher(int soTimeout,
EventConsumer consumer)
throws java.net.SocketException
java.net.SocketException
public UDPUnicastDispatcher(int soTimeout,
int port,
EventConsumer consumer)
throws java.net.SocketException
java.net.SocketException| Method Detail |
|---|
public void setBufsize(int size)
UnicastDispatcher
setBufsize in interface UnicastDispatchersetBufsize in class UDPServerUnicastDispatcher.setBufsize(int)public void setSoTimeoutListener(SocketTimeoutListener listener)
setSoTimeoutListener in interface UnicastDispatcherDatagramSocket.setSoTimeout(int),
ServerSocket.setSoTimeout(int)public void start()
UnicastDispatcher
start in interface UnicastDispatcherstart in class java.lang.ThreadUnicastDispatcher.start()public void close()
UnicastDispatcher
close in interface UnicastDispatcherUnicastDispatcher.close()
public void dispatch(ServerAddress addr,
java.lang.String type,
java.lang.Object data)
throws java.io.IOException
UnicastDispatcher
dispatch in interface UnicastDispatcheraddr - a ServerAddress that corresponds to the
destination node for the data passed in.type - the logical type of the data that is sent - allows the
receiver to perform logic according to the "type".data - the Object to send.
java.io.IOExceptionUnicastDispatcher.dispatch(ServerAddress, String, Object)
public Response send(ServerAddress addr,
java.lang.String type,
java.lang.Object data)
throws java.io.IOException
UnicastDispatcher
send in interface UnicastDispatcheraddr - a ServerAddress that corresponds to the
destination node for the data passed in.type - the logical type of the data that is sent - allows the
receiver to perform logic according to the "type".data - the Object to send.
Response.
java.io.IOExceptionUnicastDispatcher.send(ServerAddress, String, Object)
public RespList send(java.util.List addresses,
java.lang.String type,
java.lang.Object data)
throws java.io.IOException
UnicastDispatcher
send in interface UnicastDispatcheraddresses - a List of ServerAddress instances.type - the logical type of the data that is sent - allows the
receiver to perform logic according to the "type".data - the Object to send.
RespList.
java.io.IOExceptionUnicastDispatcher.send(java.util.List, String, Object)
public ServerAddress getAddress()
throws java.lang.IllegalStateException
UnicastDispatcher
getAddress in interface UnicastDispatcherServerAddress.
java.lang.IllegalStateException - if the address of this instance is not yet available.
This can be the case if the start() method has not yet been called;
therefore, always call start() before calling this method.UnicastDispatcher.getAddress()protected void handleSoTimeout()
handleSoTimeout in class UDPServerUDPServer.handleSoTimeout()protected void handlePacketSizeToShort(java.net.DatagramPacket pack)
handlePacketSizeToShort in class UDPServerUDPServer.handlePacketSizeToShort(DatagramPacket)protected int bufSize()
bufSize in class UDPServerUDPServer.bufSize()
protected void handle(java.net.DatagramPacket pack,
java.net.DatagramSocket sock)
handle in class UDPServerUDPServer.handle(DatagramPacket, DatagramSocket)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||