Package org.somda.sdc.dpws.udp
Class UdpMessageQueueServiceImpl
-
- All Implemented Interfaces:
-
com.google.common.util.concurrent.Service,org.somda.sdc.dpws.udp.UdpMessageQueueService,org.somda.sdc.dpws.udp.UdpMessageReceiverCallback
public class UdpMessageQueueServiceImpl extends AbstractIdleService implements Service, UdpMessageQueueService
Default implementation of UdpMessageQueueService.
-
-
Method Summary
Modifier and Type Method Description booleansendMessage(UdpMessage message)Queues an outgoing UDP message. voidregisterUdpMessageQueueObserver(UdpMessageQueueObserver observer)Registers an observer to receive incoming UDP messages. voidunregisterUdpMessageQueueObserver(UdpMessageQueueObserver observer)Unregisters an observer to stop receiving incoming UDP messages. voidreceive(UdpMessage udpMessage)Receive one incoming UDP message. voidsetUdpBinding(UdpBindingService udpBinding)Injects the UDP binding service. -
Methods inherited from class com.google.common.util.concurrent.AbstractIdleService
addListener, awaitRunning, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync, toString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
sendMessage
boolean sendMessage(UdpMessage message)
Queues an outgoing UDP message.
- Parameters:
message- the message to be send.- Returns:
true if the message could be queued, otherwise false (queue overflow).
-
registerUdpMessageQueueObserver
void registerUdpMessageQueueObserver(UdpMessageQueueObserver observer)
Registers an observer to receive incoming UDP messages.
- Parameters:
observer- the observer to register.
-
unregisterUdpMessageQueueObserver
void unregisterUdpMessageQueueObserver(UdpMessageQueueObserver observer)
Unregisters an observer to stop receiving incoming UDP messages.
- Parameters:
observer- the observer to unregister.
-
receive
void receive(UdpMessage udpMessage)
Receive one incoming UDP message.
- Parameters:
udpMessage- UDP data as received from the network.
-
setUdpBinding
void setUdpBinding(UdpBindingService udpBinding)
Injects the UDP binding service.
Without a UDP binding service the message queue cannot send and receive messages. Make sure the UDP binding is injected before the service is started.
- Parameters:
udpBinding- the UDP binding service to inject.
-
-
-
-