You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-dev@jakarta.apache.org by as...@apache.org on 2008/12/16 22:48:54 UTC
svn commit: r727172 - in /jakarta/jcs/trunk: src/conf/
src/java/org/apache/jcs/auxiliary/remote/
src/java/org/apache/jcs/auxiliary/remote/behavior/
src/java/org/apache/jcs/auxiliary/remote/server/
src/java/org/apache/jcs/engine/ xdocs/
Author: asmuts
Date: Tue Dec 16 13:48:53 2008
New Revision: 727172
URL: http://svn.apache.org/viewvc?rev=727172&view=rev
Log:
Fixed a bug in the remote cache listener interface. It was not extending a remote interface.
Modified:
jakarta/jcs/trunk/src/conf/remote.cacheRS2.ccf
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheRestore.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheListener.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheService.java
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheListeners.java
jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java
jakarta/jcs/trunk/xdocs/changes.xml
Modified: jakarta/jcs/trunk/src/conf/remote.cacheRS2.ccf
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/conf/remote.cacheRS2.ccf?rev=727172&r1=727171&r2=727172&view=diff
==============================================================================
Binary files - no diff available.
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java?rev=727172&r1=727171&r2=727172&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/AbsractRemoteCacheListener.java Tue Dec 16 13:48:53 2008
@@ -42,7 +42,7 @@
implements IRemoteCacheListener
{
/** Don't change */
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 32442324243243L;
/** The logger */
private final static Log log = LogFactory.getLog( AbsractRemoteCacheListener.class );
@@ -101,9 +101,9 @@
throws IOException
{
listenerId = id;
- if ( log.isDebugEnabled() )
+ if ( log.isInfoEnabled() )
{
- log.debug( "set listenerId = [" + id + "]" );
+ log.info( "set listenerId = [" + id + "]" );
}
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java?rev=727172&r1=727171&r2=727172&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheListener.java Tue Dec 16 13:48:53 2008
@@ -21,7 +21,6 @@
import java.io.IOException;
import java.io.Serializable;
-import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
@@ -29,6 +28,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheConstants;
+import org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheListener;
import org.apache.jcs.engine.behavior.ICompositeCacheManager;
/**
@@ -40,10 +40,10 @@
*/
public class RemoteCacheListener
extends AbsractRemoteCacheListener
- implements IRemoteCacheConstants, Serializable, Remote
+ implements IRemoteCacheConstants, Serializable, IRemoteCacheListener
{
/** Don't change */
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 25345252345322345L;
/** The logger */
private final static Log log = LogFactory.getLog( RemoteCacheListener.class );
@@ -107,4 +107,17 @@
disposed = true;
}
}
+
+ /**
+ * For easier debugging.
+ * <p>
+ * @return Basic info on this listener.
+ */
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append( "\n RemoteCacheListener: " );
+ buf.append( super.toString() );
+ return buf.toString();
+ }
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java?rev=727172&r1=727171&r2=727172&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheManager.java Tue Dec 16 13:48:53 2008
@@ -134,17 +134,18 @@
}
this.registry = "//" + host + ":" + port + "/" + service;
- if ( log.isDebugEnabled() )
+ if ( log.isInfoEnabled() )
{
- log.debug( "looking up server " + registry );
+ log.info( "Looking up server [" + registry + "]" );
}
try
{
Object obj = Naming.lookup( registry );
- if ( log.isDebugEnabled() )
+ if ( log.isInfoEnabled() )
{
- log.debug( "server found" );
+ log.info( "Server found: " + obj );
}
+
// Successful connection to the remote server.
remoteService = (IRemoteCacheService) obj;
if ( log.isDebugEnabled() )
@@ -164,6 +165,7 @@
remoteService = new ZombieRemoteCacheService();
remoteWatch = new RemoteCacheWatchRepairable();
remoteWatch.setCacheWatch( new ZombieRemoteCacheWatch() );
+
// Notify the cache monitor about the error, and kick off the
// recovery process.
RemoteCacheMonitor.getInstance().notifyError();
@@ -195,7 +197,8 @@
if ( log.isInfoEnabled() )
{
log.info( "The remote cache is configured to receive events from the remote server. "
- + "We will register a listener." );
+ + "We will register a listener. remoteWatch = " + remoteWatch + " | IRemoteCacheListener = "
+ + listener + " | cacheName " + cattr.getCacheName() );
}
synchronized ( caches )
@@ -408,11 +411,13 @@
}
catch ( IOException ioe )
{
- log.error( ioe.getMessage() );
+ log.error( "IOException. Problem adding listener. Message: " + ioe.getMessage()
+ + " | RemoteCacheListener = " + listener, ioe );
}
catch ( Exception e )
{
- log.error( e.getMessage() );
+ log.error( "Problem adding listener. Message: " + e.getMessage() + " | RemoteCacheListener = "
+ + listener, e );
}
IRemoteCacheClient remoteCacheClient = new RemoteCache( cattr, remoteService, listener );
@@ -515,6 +520,10 @@
*/
public void fixCaches( IRemoteCacheService remoteService, IRemoteCacheObserver remoteWatch )
{
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Fixing caches. IRemoteCacheService " + remoteService + " | IRemoteCacheObserver " + remoteWatch );
+ }
synchronized ( caches )
{
this.remoteService = remoteService;
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java?rev=727172&r1=727171&r2=727172&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheMonitor.java Tue Dec 16 13:48:53 2008
@@ -215,7 +215,7 @@
// Problem encountered in fixing the caches managed by a
// RemoteCacheManager instance.
// Soldier on to the next RemoteCacheManager instance.
- log.error( ex );
+ log.error( "Problem fixing caches for manager." + mgr, ex );
}
}
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheRestore.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheRestore.java?rev=727172&r1=727171&r2=727172&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheRestore.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCacheRestore.java Tue Dec 16 13:48:53 2008
@@ -78,14 +78,14 @@
String registry = "//" + remoteCacheManager.host + ":" + remoteCacheManager.port + "/" + remoteCacheManager.service;
if ( log.isInfoEnabled() )
{
- log.info( "looking up server " + registry );
+ log.info( "looking up server [" + registry + "]" );
}
try
{
remoteObj = Naming.lookup( registry );
if ( log.isInfoEnabled() )
{
- log.info( "looking up server " + registry );
+ log.info( "Found server " + remoteObj );
}
}
catch ( Exception ex )
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheListener.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheListener.java?rev=727172&r1=727171&r2=727172&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheListener.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheListener.java Tue Dec 16 13:48:53 2008
@@ -20,6 +20,7 @@
*/
import java.io.IOException;
+import java.rmi.Remote;
import org.apache.jcs.engine.behavior.ICacheListener;
@@ -27,7 +28,7 @@
* Listens for remote cache event notification ( rmi callback ).
*/
public interface IRemoteCacheListener
- extends ICacheListener
+ extends ICacheListener, Remote
{
/** SERVER_LISTENER -- for the cluster */
public final static int SERVER_LISTENER = 0;
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheService.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheService.java?rev=727172&r1=727171&r2=727172&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheService.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/behavior/IRemoteCacheService.java Tue Dec 16 13:48:53 2008
@@ -58,7 +58,7 @@
throws IOException;
/**
- * Remove all keys from the sepcified cache.
+ * Remove all keys from the specified cache.
* <p>
* @param cacheName
* @param requesterId
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java?rev=727172&r1=727171&r2=727172&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java Tue Dec 16 13:48:53 2008
@@ -1296,7 +1296,7 @@
{
throw new IllegalArgumentException( "cacheName and listener must not be null" );
}
- CacheListeners cacheDesc;
+ CacheListeners cacheListeners;
IRemoteCacheListener ircl = (IRemoteCacheListener) listener;
@@ -1306,14 +1306,14 @@
if ( remoteType == IRemoteCacheAttributes.CLUSTER )
{
log.debug( "adding cluster listener, listenerAddress [" + listenerAddress + "]" );
- cacheDesc = getClusterListeners( cacheName );
+ cacheListeners = getClusterListeners( cacheName );
}
else
{
log.debug( "adding normal listener, listenerAddress [" + listenerAddress + "]" );
- cacheDesc = getCacheListeners( cacheName );
+ cacheListeners = getCacheListeners( cacheName );
}
- Map eventQMap = cacheDesc.eventQMap;
+ Map eventQMap = cacheListeners.eventQMap;
cleanupEventQMap( eventQMap );
// synchronized ( listenerId )
@@ -1337,7 +1337,7 @@
id = listenerIdB;
// in case it needs synchronization
- String message = "adding vm listener under new id = [" + listenerIdB + "], listenerAddress ["
+ String message = "Adding vm listener under new id = [" + listenerIdB + "], listenerAddress ["
+ listenerAddress + "]";
logApplicationEvent( "RemoteCacheServer", "addCacheListener", message );
if ( log.isInfoEnabled() )
@@ -1347,7 +1347,7 @@
}
else
{
- String message = "adding listener under existing id = [" + id + "], listenerAddress ["
+ String message = "Adding listener under existing id = [" + id + "], listenerAddress ["
+ listenerAddress + "]";
logApplicationEvent( "RemoteCacheServer", "addCacheListener", message );
if ( log.isInfoEnabled() )
@@ -1385,7 +1385,7 @@
if ( log.isInfoEnabled() )
{
- log.info( "Region " + cacheName + "'s listener size = " + cacheDesc.eventQMap.size() );
+ log.info( cacheListeners );
}
}
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheListeners.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheListeners.java?rev=727172&r1=727171&r2=727172&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheListeners.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheListeners.java Tue Dec 16 13:48:53 2008
@@ -20,6 +20,7 @@
*/
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.Map;
import org.apache.jcs.engine.behavior.ICache;
@@ -49,4 +50,30 @@
}
this.cache = cache;
}
+
+ /** @return info on the listeners */
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append( "\n CacheListeners" );
+ if ( cache != null )
+ {
+ buffer.append( "\n Region = " + cache.getCacheName() );
+ }
+ if ( eventQMap != null )
+ {
+ buffer.append( "\n Event Queue Map " );
+ buffer.append( "\n size = " + eventQMap.size() );
+ Iterator it = eventQMap.entrySet().iterator();
+ while ( it.hasNext() )
+ {
+ buffer.append( "\n Entry: " + it.next() );
+ }
+ }
+ else
+ {
+ buffer.append( "\n No Listeners. " );
+ }
+ return buffer.toString();
+ }
}
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java?rev=727172&r1=727171&r2=727172&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/engine/CacheWatchRepairable.java Tue Dec 16 13:48:53 2008
@@ -32,10 +32,9 @@
import org.apache.jcs.engine.behavior.ICacheObserver;
/**
- * Intercepts the requests to the underlying ICacheObserver object so that the
- * listeners can be recorded locally for remote connection recovery purposes.
- * (Durable subscription like those in JMS is not implemented at this stage for
- * it can be too expensive.)
+ * Intercepts the requests to the underlying ICacheObserver object so that the listeners can be
+ * recorded locally for remote connection recovery purposes. (Durable subscription like those in JMS
+ * is not implemented at this stage for it can be too expensive.)
*/
public class CacheWatchRepairable
implements ICacheObserver
@@ -50,11 +49,10 @@
private Map cacheMap = new HashMap();
/**
- * Replaces the underlying cache watch service and reattached all existing
- * listeners to the new cache watch.
+ * Replaces the underlying cache watch service and reattached all existing listeners to the new
+ * cache watch.
* <p>
- * @param cacheWatch
- * The new cacheWatch value
+ * @param cacheWatch The new cacheWatch value
*/
public void setCacheWatch( ICacheObserver cacheWatch )
{
@@ -68,13 +66,20 @@
Set listenerSet = (Set) entry.getValue();
for ( Iterator itr2 = listenerSet.iterator(); itr2.hasNext(); )
{
+ ICacheListener listener = (ICacheListener) itr2.next();
try
{
- cacheWatch.addCacheListener( cacheName, (ICacheListener) itr2.next() );
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Adding listener to cache watch. ICacheListener = " + listener
+ + " | ICacheObserver = " + cacheWatch );
+ }
+ cacheWatch.addCacheListener( cacheName, listener );
}
catch ( IOException ex )
{
- log.error( "Problem adding listener.", ex );
+ log.error( "Problem adding listener. ICacheListener = " + listener + " | ICacheObserver = "
+ + cacheWatch, ex );
}
}
}
@@ -82,13 +87,10 @@
}
/**
- * Adds a feature to the CacheListener attribute of the CacheWatchRepairable
- * object
+ * Adds a feature to the CacheListener attribute of the CacheWatchRepairable object
* <p>
- * @param cacheName
- * The feature to be added to the CacheListener attribute
- * @param obj
- * The feature to be added to the CacheListener attribute
+ * @param cacheName The feature to be added to the CacheListener attribute
+ * @param obj The feature to be added to the CacheListener attribute
* @throws IOException
*/
public void addCacheListener( String cacheName, ICacheListener obj )
@@ -102,19 +104,23 @@
if ( listenerSet == null )
{
listenerSet = new HashSet();
+
cacheMap.put( cacheName, listenerSet );
}
listenerSet.add( obj );
}
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Adding listener to cache watch. ICacheListener = " + obj
+ + " | ICacheObserver = " + cacheWatch + " | cacheName = " + cacheName );
+ }
cacheWatch.addCacheListener( cacheName, obj );
}
/**
- * Adds a feature to the CacheListener attribute of the CacheWatchRepairable
- * object
+ * Adds a feature to the CacheListener attribute of the CacheWatchRepairable object
* <p>
- * @param obj
- * The feature to be added to the CacheListener attribute
+ * @param obj The feature to be added to the CacheListener attribute
* @throws IOException
*/
public void addCacheListener( ICacheListener obj )
@@ -130,6 +136,11 @@
listenerSet.add( obj );
}
}
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Adding listener to cache watch. ICacheListener = " + obj
+ + " | ICacheObserver = " + cacheWatch );
+ }
cacheWatch.addCacheListener( obj );
}
Modified: jakarta/jcs/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/xdocs/changes.xml?rev=727172&r1=727171&r2=727172&view=diff
==============================================================================
--- jakarta/jcs/trunk/xdocs/changes.xml (original)
+++ jakarta/jcs/trunk/xdocs/changes.xml Tue Dec 16 13:48:53 2008
@@ -21,6 +21,9 @@
<body>
<release version="1.4-dev" date="in SVN">
</release>
+ <release version="1.3.2.8" date="2008-12-16" description="tempbuild">
+ <action dev="asmuts" type="fix">Fixed bug remote cache listener interface.</action>
+ </release>
<release version="1.3.2.7" date="2008-12-15" description="tempbuild">
<action dev="asmuts" type="update">Added a simple http remote
cache client and server.</action>
---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org