org.lwes.listener
Class DatagramEnqueuer

java.lang.Object
  extended by org.lwes.listener.ThreadedEnqueuer
      extended by org.lwes.listener.DatagramEnqueuer
All Implemented Interfaces:
java.lang.Runnable

public class DatagramEnqueuer
extends ThreadedEnqueuer

This class listens to packets sent via UDP, and enqueues them for processing. It detects multicast addresses and listens to multicast groups if one is detected, otherwise it listens for unicast datagrams.

Author:
Anthony Molinaro, Michael P. Lum

Field Summary
 
Fields inherited from class org.lwes.listener.ThreadedEnqueuer
queue
 
Constructor Summary
DatagramEnqueuer()
           
 
Method Summary
 java.net.InetAddress getAddress()
          Gets the network address being used for this listener.
 java.net.InetAddress getInterface()
          Gets the network interface being used for this listener.
 int getPort()
          Gets the port being used for this listener.
 int getTimeToLive()
          Returns the multicast TTL (if applicable).
 void initialize()
          Default initialize() method.
 void run()
          While running, repeatedly read datagrams and insert them into the queue along with the receipt time and other metadata.
 void setAddress(java.net.InetAddress address)
          Sets the address being used for this listener.
 void setInterface(java.net.InetAddress iface)
          Sets the network interface to use for this listener.
 void setPort(int port)
          Sets the port being used for this listener.
 void setTimeToLive(int ttl)
          Sets the multicast TTL.
 void shutdown()
          Default shutdown() method.
 
Methods inherited from class org.lwes.listener.ThreadedEnqueuer
getQueue, setQueue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatagramEnqueuer

public DatagramEnqueuer()
Method Detail

getAddress

public java.net.InetAddress getAddress()
Gets the network address being used for this listener.

Returns:
the address

setAddress

public void setAddress(java.net.InetAddress address)
Sets the address being used for this listener.

Parameters:
address - the address to use

getPort

public int getPort()
Gets the port being used for this listener.

Returns:
the port number

setPort

public void setPort(int port)
Sets the port being used for this listener.

Parameters:
port - the port number

getInterface

public java.net.InetAddress getInterface()
Gets the network interface being used for this listener.

Returns:
the interface

setInterface

public void setInterface(java.net.InetAddress iface)
Sets the network interface to use for this listener.

Parameters:
iface - the interface

getTimeToLive

public int getTimeToLive()
Returns the multicast TTL (if applicable). Applies to multicast listeners only.

Returns:
the TTL value

setTimeToLive

public void setTimeToLive(int ttl)
Sets the multicast TTL. This typically does not need to be modified. Applies to multicast listeners only.

Parameters:
ttl - the multicast TTL value.

initialize

public void initialize()
                throws java.io.IOException
Description copied from class: ThreadedEnqueuer
Default initialize() method. Should be overridden by classes extending ThreadedEnqueuer.

Overrides:
initialize in class ThreadedEnqueuer
Throws:
java.io.IOException

shutdown

public void shutdown()
Description copied from class: ThreadedEnqueuer
Default shutdown() method. Should be overridden by classes extending ThreadedDequeuer.

Overrides:
shutdown in class ThreadedEnqueuer

run

public void run()
While running, repeatedly read datagrams and insert them into the queue along with the receipt time and other metadata.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class ThreadedEnqueuer