Class UdpMessageQueueServiceImpl

java.lang.Object
com.google.common.util.concurrent.AbstractIdleService
org.somda.sdc.dpws.udp.UdpMessageQueueServiceImpl
All Implemented Interfaces:
com.google.common.util.concurrent.Service, UdpMessageQueueService, UdpMessageReceiverCallback

public class UdpMessageQueueServiceImpl extends com.google.common.util.concurrent.AbstractIdleService implements com.google.common.util.concurrent.Service, UdpMessageQueueService
Default implementation of UdpMessageQueueService.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service

    com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    receive(UdpMessage udpMessage)
    Receive one incoming UDP message.
    void
    Registers an observer to receive incoming UDP messages.
    boolean
    Queues an outgoing UDP message.
    void
    Injects the UDP binding service.
    protected void
     
    protected void
     
    void
    Unregisters an observer to stop receiving incoming UDP messages.

    Methods inherited from class com.google.common.util.concurrent.AbstractIdleService

    addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.google.common.util.concurrent.Service

    addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync
  • Method Details

    • setUdpBinding

      public void setUdpBinding(UdpBindingService udpBinding)
      Description copied from interface: UdpMessageQueueService
      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.

      Specified by:
      setUdpBinding in interface UdpMessageQueueService
      Parameters:
      udpBinding - the UDP binding service to inject.
    • sendMessage

      public boolean sendMessage(UdpMessage message)
      Description copied from interface: UdpMessageQueueService
      Queues an outgoing UDP message.
      Specified by:
      sendMessage in interface UdpMessageQueueService
      Parameters:
      message - the message to be send.
      Returns:
      true if the message could be queued, otherwise false (queue overflow).
    • registerUdpMessageQueueObserver

      public void registerUdpMessageQueueObserver(UdpMessageQueueObserver observer)
      Description copied from interface: UdpMessageQueueService
      Registers an observer to receive incoming UDP messages.
      Specified by:
      registerUdpMessageQueueObserver in interface UdpMessageQueueService
      Parameters:
      observer - the observer to register.
    • unregisterUdpMessageQueueObserver

      public void unregisterUdpMessageQueueObserver(UdpMessageQueueObserver observer)
      Description copied from interface: UdpMessageQueueService
      Unregisters an observer to stop receiving incoming UDP messages.
      Specified by:
      unregisterUdpMessageQueueObserver in interface UdpMessageQueueService
      Parameters:
      observer - the observer to unregister.
    • startUp

      protected void startUp() throws Exception
      Specified by:
      startUp in class com.google.common.util.concurrent.AbstractIdleService
      Throws:
      Exception
    • shutDown

      protected void shutDown()
      Specified by:
      shutDown in class com.google.common.util.concurrent.AbstractIdleService
    • receive

      public void receive(UdpMessage udpMessage)
      Description copied from interface: UdpMessageReceiverCallback
      Receive one incoming UDP message.
      Specified by:
      receive in interface UdpMessageReceiverCallback
      Parameters:
      udpMessage - UDP data as received from the network. The message contains the payload as well as the sender's address and port.