org.apache.jcs.auxiliary.lateral.socket.tcp.discovery
Class UDPDiscoveryReceiver

java.lang.Object
  extended byorg.apache.jcs.auxiliary.lateral.socket.tcp.discovery.UDPDiscoveryReceiver
All Implemented Interfaces:
IShutdownObserver, java.lang.Runnable

public class UDPDiscoveryReceiver
extends java.lang.Object
implements java.lang.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 hande request broadcasts
 
Constructor Summary
UDPDiscoveryReceiver(UDPDiscoveryService service, java.lang.String multicastAddressString, int multicastPort, ICompositeCacheManager cacheMgr)
          Constructor for the LateralUDPReceiver object.
 
Method Summary
 int getCnt()
           
 void run()
          Main processing method for the LateralUDPReceiver object
 void setCnt(int cnt)
           
 void shutdown()
          Tells the observer that the observable has received a shutdown command.
 java.lang.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 hande request broadcasts

Constructor Detail

UDPDiscoveryReceiver

public UDPDiscoveryReceiver(UDPDiscoveryService service,
                            java.lang.String multicastAddressString,
                            int multicastPort,
                            ICompositeCacheManager cacheMgr)
                     throws java.io.IOException
Constructor for the LateralUDPReceiver object.

We determine out own host using InetAddress

Parameters:
service -
multicastAddressString -
multicastPort -
cacheMgr -
Throws:
java.io.IOException
Method Detail

waitForMessage

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

Returns:
the object message
Throws:
java.io.IOException

run

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

Specified by:
run in interface java.lang.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()
Description copied from interface: IShutdownObserver
Tells the observer that the observable has received a shutdown command.

Specified by:
shutdown in interface IShutdownObserver


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