org.apache.jcs.auxiliary.lateral.javagroups
Class LateralCacheJGListener

java.lang.Object
  extended byorg.apache.jcs.auxiliary.lateral.javagroups.LateralCacheJGListener
All Implemented Interfaces:
ICacheListener, ILateralCacheJGListener, ILateralCacheListener, java.io.Serializable
Direct Known Subclasses:
LateralGroupCacheJGListener

public class LateralCacheJGListener
extends java.lang.Object
implements ILateralCacheJGListener, java.io.Serializable

JavaGroups listener. Good for distributing cache data accross multiple vms on the same machine. You also don't need to know the number of listerners for configuration.

See Also:
Serialized Form

Field Summary
protected static CompositeCacheManager cacheMgr
          Description of the Field
protected static java.util.HashMap instances
          Description of the Field
 
Constructor Summary
protected LateralCacheJGListener(ILateralCacheAttributes ilca)
          Only need one since it does work for all regions, just reference by multiple region names.
 
Method Summary
protected  CompositeCache getCache(java.lang.String name)
          Gets the cacheManager attribute of the LateralCacheTCPListener object
static ILateralCacheListener getInstance(ILateralCacheAttributes ilca)
          Gets the instance attribute of the LateralCacheJGListener class
 long getListenerId()
          Gets the listenerId attribute of the LateralCacheJGListener object
 void handleDispose(java.lang.String cacheName)
          Description of the Method
 java.io.Serializable handleGet(java.lang.String cacheName, java.io.Serializable key)
          Test get implementation.
 void handlePut(ICacheElement element)
          Notifies the subscribers for a cache entry update.
 void handleRemove(java.lang.String cacheName, java.io.Serializable key)
          Description of the Method
 void handleRemoveAll(java.lang.String cacheName)
          Description of the Method
 void init()
          Description of the Method
 void setListenerId(long id)
          let the lateral cache set a listener_id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cacheMgr

protected static transient CompositeCacheManager cacheMgr
Description of the Field


instances

protected static final java.util.HashMap instances
Description of the Field

Constructor Detail

LateralCacheJGListener

protected LateralCacheJGListener(ILateralCacheAttributes ilca)
Only need one since it does work for all regions, just reference by multiple region names.

Parameters:
ilca -
Method Detail

init

public void init()
Description of the Method

Specified by:
init in interface ILateralCacheJGListener

setListenerId

public void setListenerId(long id)
                   throws java.io.IOException
let the lateral cache set a listener_id. Since there is only one listerenr for all the regions and every region gets registered? the id shouldn't be set if it isn't zero. If it is we assume that it is a reconnect.

Specified by:
setListenerId in interface ICacheListener
Parameters:
id - The new listenerId value
Throws:
java.io.IOException

getListenerId

public long getListenerId()
                   throws java.io.IOException
Gets the listenerId attribute of the LateralCacheJGListener object

Specified by:
getListenerId in interface ICacheListener
Returns:
The listenerId value
Throws:
java.io.IOException

getInstance

public static ILateralCacheListener getInstance(ILateralCacheAttributes ilca)
Gets the instance attribute of the LateralCacheJGListener class

Parameters:
ilca -
Returns:
The instance value

handlePut

public void handlePut(ICacheElement element)
               throws java.io.IOException
Description copied from interface: ICacheListener
Notifies the subscribers for a cache entry update.

Specified by:
handlePut in interface ICacheListener
Throws:
java.io.IOException

handleRemove

public void handleRemove(java.lang.String cacheName,
                         java.io.Serializable key)
                  throws java.io.IOException
Description of the Method

Specified by:
handleRemove in interface ICacheListener
Parameters:
cacheName -
key -
Throws:
java.io.IOException

handleRemoveAll

public void handleRemoveAll(java.lang.String cacheName)
                     throws java.io.IOException
Description of the Method

Specified by:
handleRemoveAll in interface ICacheListener
Parameters:
cacheName -
Throws:
java.io.IOException

handleGet

public java.io.Serializable handleGet(java.lang.String cacheName,
                                      java.io.Serializable key)
                               throws java.io.IOException
Test get implementation.

Specified by:
handleGet in interface ILateralCacheJGListener
Parameters:
cacheName -
key -
Returns:
Throws:
java.io.IOException

handleDispose

public void handleDispose(java.lang.String cacheName)
                   throws java.io.IOException
Description of the Method

Specified by:
handleDispose in interface ICacheListener
Parameters:
cacheName -
Throws:
java.io.IOException

getCache

protected CompositeCache getCache(java.lang.String name)
Gets the cacheManager attribute of the LateralCacheTCPListener object



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