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

java.lang.Object
  extended byorg.apache.jcs.auxiliary.lateral.socket.tcp.discovery.UDPDiscoveryService

public class UDPDiscoveryService
extends java.lang.Object

This service creates a listener that can create lateral caches and add them to the no wait list.

It also creates a sender that periodically broadcasts its availability.

The sender also broadcasts a request for other caches to broadcast their addresses.

Author:
Aaron Smuts

Constructor Summary
UDPDiscoveryService(LateralCacheAttributes lca)
           
 
Method Summary
protected  void addNoWait(LateralCacheNoWait noWait)
          This adds nowaits to a facde for the region name.
 boolean addNoWaitFacade(LateralCacheNoWaitFacade facade, java.lang.String cacheName)
          Adds a nowait facade under this cachename.
protected  java.util.ArrayList getCacheNames()
          Get all the cache names we have facades for.
 LateralCacheAttributes getLca()
           
protected  void serviceRequestBroadcast()
          Send a passive broadcast in response to a request broadcast.
 void setLca(LateralCacheAttributes lca)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UDPDiscoveryService

public UDPDiscoveryService(LateralCacheAttributes lca)
Parameters:
lca -
Method Detail

addNoWaitFacade

public boolean addNoWaitFacade(LateralCacheNoWaitFacade facade,
                               java.lang.String cacheName)
Adds a nowait facade under this cachename. If one already existed, it will be overridden.

When a broadcast is received from the UDP Discovery receiver, for each cacheName in the message, the add no wait will be called here. To add a no wait, the facade is looked up for this cache name.

Parameters:
facade -
cacheName -
Returns:
true if the facade was not already registered.

addNoWait

protected void addNoWait(LateralCacheNoWait noWait)
This adds nowaits to a facde for the region name. If the region has no facade, then it is not configured to use the lateral cache, and no facde will be created.

Parameters:
noWait -

serviceRequestBroadcast

protected void serviceRequestBroadcast()
Send a passive broadcast in response to a request broadcast. Never send a request for a request. We can respond to our own reques, since a request broadcast is not intended as a connection request. We might want to only send messages, so we would send a request, but never a passive broadcast.


getCacheNames

protected java.util.ArrayList getCacheNames()
Get all the cache names we have facades for.

Returns:

setLca

public void setLca(LateralCacheAttributes lca)
Parameters:
lca - The lca to set.

getLca

public LateralCacheAttributes getLca()
Returns:
Returns the lca.


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