org.apache.jcs.utils.discovery
Class UDPDiscoveryReceiver

java.lang.Object
  extended by org.apache.jcs.utils.discovery.UDPDiscoveryReceiver
All Implemented Interfaces:
Runnable, IShutdownObserver

public class UDPDiscoveryReceiver
extends Object
implements Runnable, IShutdownObserver

Receives UDP Discovery messages.


Nested Class Summary
 class UDPDiscoveryReceiver.MessageHandler
          Separate thread run when a command comes into the UDPDiscoveryReceiver.
 
Field Summary
protected  UDPDiscoveryService service
          Service to get cache names and handle request broadcasts
 
Constructor Summary
UDPDiscoveryReceiver(UDPDiscoveryService service, String multicastAddressString, int multicastPort)
          Constructor for the LateralUDPReceiver object.
 
Method Summary
 int getCnt()
           
 void run()
          Main processing method for the LateralUDPReceiver object
 void setCnt(int cnt)
           
 void shutdown()
          Shuts down the socket.
 Object waitForMessage()
          Highly unreliable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

service

protected UDPDiscoveryService service
Service to get cache names and handle request broadcasts

Constructor Detail

UDPDiscoveryReceiver

public UDPDiscoveryReceiver(UDPDiscoveryService service,
                            String multicastAddressString,
                            int multicastPort)
                     throws IOException
Constructor for the LateralUDPReceiver object.

We determine out own host using InetAddress

Parameters:
service -
multicastAddressString -
multicastPort -
Throws:
IOException
Method Detail

waitForMessage

public Object waitForMessage()
                      throws IOException
Highly unreliable. If it is processing one message while another comes in, the second message is lost. This is for low concurrency peppering.

Returns:
the object message
Throws:
IOException

run

public void run()
Main processing method for the LateralUDPReceiver object

Specified by:
run in interface Runnable

setCnt

public void setCnt(int cnt)
Parameters:
cnt - The cnt to set.

getCnt

public int getCnt()
Returns:
Returns the cnt.

shutdown

public void shutdown()
Shuts down the socket.

Specified by:
shutdown in interface IShutdownObserver


Copyright © 2002-2012 Apache Software Foundation. All Rights Reserved.