Author: tv
Date: Tue Mar 22 16:21:29 2016
New Revision: 1736208
URL: http://svn.apache.org/viewvc?rev=1736208&view=rev
Log:
Further clean up API and class dependencies
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheListener.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListener.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpClientListener.java
commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheListener.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheListener.java?rev=1736208&r1=1736207&r2=1736208&view=diff
==============================================================================
---
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheListener.java
(original)
+++
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheListener.java
Tue Mar 22 16:21:29 2016
@@ -20,7 +20,6 @@ package org.apache.commons.jcs.auxiliary
*/
import java.io.IOException;
-import java.io.Serializable;
import java.net.UnknownHostException;
import org.apache.commons.jcs.access.exception.CacheException;
@@ -31,21 +30,16 @@ import org.apache.commons.jcs.engine.beh
import org.apache.commons.jcs.engine.behavior.ICacheElementSerialized;
import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
import org.apache.commons.jcs.engine.behavior.IElementSerializer;
-import org.apache.commons.jcs.engine.control.CompositeCache;
import org.apache.commons.jcs.engine.control.CompositeCacheManager;
import org.apache.commons.jcs.utils.net.HostNameUtil;
import org.apache.commons.jcs.utils.serialization.SerializationConversionUtil;
-import org.apache.commons.jcs.utils.serialization.StandardSerializer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** Shared listener base. */
public abstract class AbstractRemoteCacheListener<K, V>
- implements IRemoteCacheListener<K, V>, Serializable
+ implements IRemoteCacheListener<K, V>
{
- /** Don't change */
- private static final long serialVersionUID = 32442324243243L;
-
/** The logger */
private static final Log log = LogFactory.getLog(
AbstractRemoteCacheListener.class );
@@ -56,22 +50,16 @@ public abstract class AbstractRemoteCach
* The cache manager used to put items in different regions. This is set
lazily and should not
* be sent to the remote server.
*/
- private transient ICompositeCacheManager cacheMgr;
+ private ICompositeCacheManager cacheMgr;
/** The remote cache configuration object. */
private final IRemoteCacheAttributes irca;
- /** Number of put requests received. For debugging only. */
- protected int puts = 0;
-
- /** Number of remove requests received. For debugging only. */
- protected int removes = 0;
-
/** This is set by the remote cache server. */
private long listenerId = 0;
- /** Custom serializer. Standard by default. */
- private transient IElementSerializer elementSerializer = new
StandardSerializer();
+ /** Custom serializer. */
+ private IElementSerializer elementSerializer;
/**
* Only need one since it does work for all regions, just reference by
multiple region names.
@@ -79,13 +67,15 @@ public abstract class AbstractRemoteCach
* The constructor exports this object, making it available to receive
incoming calls. The
* callback port is anonymous unless a local port value was specified in
the configuration.
* <p>
- * @param irca
- * @param cacheMgr
+ * @param irca cache configuration
+ * @param cacheMgr the cache hub
+ * @param elementSerializer a custom serializer
*/
- public AbstractRemoteCacheListener( IRemoteCacheAttributes irca,
ICompositeCacheManager cacheMgr )
+ public AbstractRemoteCacheListener( IRemoteCacheAttributes irca,
ICompositeCacheManager cacheMgr, IElementSerializer elementSerializer )
{
this.irca = irca;
this.cacheMgr = cacheMgr;
+ this.elementSerializer = elementSerializer;
}
/**
@@ -167,20 +157,12 @@ public abstract class AbstractRemoteCach
}
else
{
- puts++;
if ( log.isDebugEnabled() )
{
log.debug( "PUTTING ELEMENT FROM REMOTE, ( updating ) " );
log.debug( "cb = " + cb );
-
- if ( puts % 100 == 0 )
- {
- log.debug( "puts = " + puts );
- }
}
- CompositeCache<K, V> cache = getCacheManager().getCache(
cb.getCacheName() );
-
// Eventually the instance of will not be necessary.
if ( cb instanceof ICacheElementSerialized )
{
@@ -207,7 +189,7 @@ public abstract class AbstractRemoteCach
}
}
- cache.localUpdate( cb );
+ getCacheManager().<K, V>getCache( cb.getCacheName() ).localUpdate(
cb );
}
}
@@ -222,20 +204,12 @@ public abstract class AbstractRemoteCach
public void handleRemove( String cacheName, K key )
throws IOException
{
- removes++;
if ( log.isDebugEnabled() )
{
- if ( removes % 100 == 0 )
- {
- log.debug( "removes = " + removes );
- }
-
log.debug( "handleRemove> cacheName=" + cacheName + ", key=" + key
);
}
- CompositeCache<K, V> cache = getCacheManager().getCache( cacheName );
-
- cache.localRemove( key );
+ getCacheManager().<K, V>getCache( cacheName ).localRemove( key );
}
/**
@@ -253,8 +227,7 @@ public abstract class AbstractRemoteCach
log.debug( "handleRemoveAll> cacheName=" + cacheName );
}
- CompositeCache<K, V> cache = getCacheManager().getCache( cacheName );
- cache.localRemoveAll();
+ getCacheManager().<K, V>getCache( cacheName ).localRemoveAll();
}
/**
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java?rev=1736208&r1=1736207&r2=1736208&view=diff
==============================================================================
---
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
(original)
+++
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
Tue Mar 22 16:21:29 2016
@@ -55,9 +55,6 @@ public abstract class AbstractRemoteCach
/** holds failover and cluster information */
private IRemoteCacheAttributes remoteCacheAttributes;
- /** A cache manager */
- private ICompositeCacheManager compositeCacheManager;
-
/**
* Constructs with the given remote cache, and fires events to any
listeners.
* <p>
@@ -81,7 +78,6 @@ public abstract class AbstractRemoteCach
this.noWaits.add((RemoteCacheNoWait<K,V>) nw);
}
this.remoteCacheAttributes = rca;
- setCompositeCacheManager( cacheMgr );
setCacheEventLogger( cacheEventLogger );
setElementSerializer( elementSerializer );
}
@@ -443,20 +439,4 @@ public abstract class AbstractRemoteCach
{
return "Remote Cache No Wait Facade";
}
-
- /**
- * @param compositeCacheManager the compositeCacheManager to set
- */
- private void setCompositeCacheManager( ICompositeCacheManager
compositeCacheManager )
- {
- this.compositeCacheManager = compositeCacheManager;
- }
-
- /**
- * @return the compositeCacheManager
- */
- protected ICompositeCacheManager getCompositeCacheManager()
- {
- return compositeCacheManager;
- }
}
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java?rev=1736208&r1=1736207&r2=1736208&view=diff
==============================================================================
---
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java
(original)
+++
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java
Tue Mar 22 16:21:29 2016
@@ -182,6 +182,28 @@ public class RemoteCacheFactory
* <p>
* Host and Port uniquely identify a manager instance.
* <p>
+ * @param cattr
+ *
+ * @return The instance value or null if no such manager exists
+ */
+ public static RemoteCacheManager getManager( IRemoteCacheAttributes cattr )
+ {
+ if ( cattr.getRemoteLocation() == null )
+ {
+ cattr.setRemoteLocation("", Registry.REGISTRY_PORT);
+ }
+
+ RemoteLocation loc = cattr.getRemoteLocation();
+ RemoteCacheManager ins = managers.get( loc );
+
+ return ins;
+ }
+
+ /**
+ * Returns an instance of RemoteCacheManager for the given connection
parameters.
+ * <p>
+ * Host and Port uniquely identify a manager instance.
+ * <p>
* If the connection cannot be established, zombie objects will be used
for future recovery
* purposes.
* <p>
@@ -189,7 +211,7 @@ public class RemoteCacheFactory
* @param cacheMgr
* @param cacheEventLogger
* @param elementSerializer
- * @return The instance value
+ * @return The instance value, never null
*/
public static RemoteCacheManager getManager( IRemoteCacheAttributes cattr,
ICompositeCacheManager cacheMgr,
ICacheEventLogger
cacheEventLogger,
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java?rev=1736208&r1=1736207&r2=1736208&view=diff
==============================================================================
---
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java
(original)
+++
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java
Tue Mar 22 16:21:29 2016
@@ -27,7 +27,6 @@ import org.apache.commons.jcs.auxiliary.
import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
import org.apache.commons.jcs.engine.CacheStatus;
import org.apache.commons.jcs.engine.behavior.ICache;
-import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
/**
* The RemoteCacheFailoverRunner tries to establish a connection with a
failover
@@ -53,22 +52,16 @@ public class RemoteCacheFailoverRunner<K
/** The facade returned to the composite cache. */
private final RemoteCacheNoWaitFacade<K, V> facade;
- /** The cache manager */
- private final ICompositeCacheManager cacheMgr;
-
/**
* Constructor for the RemoteCacheFailoverRunner object. This allows the
* FailoverRunner to modify the facade that the CompositeCache references.
*
- * @param facade
- * the facade the CompositeCache talks to.
- * @param cacheMgr
+ * @param facade the facade the CompositeCache talks to.
*/
- public RemoteCacheFailoverRunner( RemoteCacheNoWaitFacade<K, V> facade,
ICompositeCacheManager cacheMgr )
+ public RemoteCacheFailoverRunner( RemoteCacheNoWaitFacade<K, V> facade )
{
super("JCS-RemoteCacheFailoverRunner");
this.facade = facade;
- this.cacheMgr = cacheMgr;
setIdlePeriod(20000L);
}
@@ -187,42 +180,44 @@ public class RemoteCacheFailoverRunner<K
RemoteCacheAttributes rca = (RemoteCacheAttributes)
rca0.clone();
rca.setRemoteLocation(server);
- RemoteCacheManager rcm = RemoteCacheFactory.getManager(
rca, cacheMgr,
- facade.getCacheEventLogger(),
facade.getElementSerializer() );
+ RemoteCacheManager rcm = RemoteCacheFactory.getManager(
rca );
if ( log.isDebugEnabled() )
{
log.debug( "RemoteCacheAttributes for failover = " +
rca.toString() );
}
- // add a listener if there are none, need to tell rca
- // what number it is at
- ICache<K, V> ic = rcm.getCache( rca );
- if ( ic.getStatus() == CacheStatus.ALIVE )
+ if (rcm != null)
{
- // may need to do this more gracefully
- log.debug( "resetting no wait" );
- facade.restorePrimaryServer((RemoteCacheNoWait<K, V>)
ic);
- rca0.setFailoverIndex( i.nextIndex() );
-
- if ( log.isDebugEnabled() )
+ // add a listener if there are none, need to tell rca
+ // what number it is at
+ ICache<K, V> ic = rcm.getCache( rca );
+ if ( ic.getStatus() == CacheStatus.ALIVE )
{
- log.debug( "setting ALLRIGHT to true" );
- if ( i.hasPrevious() )
- {
- log.debug( "Moving to Primary Recovery Mode,
failover index = " + i.nextIndex() );
- }
- else
+ // may need to do this more gracefully
+ log.debug( "resetting no wait" );
+ facade.restorePrimaryServer((RemoteCacheNoWait<K,
V>) ic);
+ rca0.setFailoverIndex( i.nextIndex() );
+
+ if ( log.isDebugEnabled() )
{
- log.debug( "No need to connect to failover,
the primary server is back up." );
+ log.debug( "setting ALLRIGHT to true" );
+ if ( i.hasPrevious() )
+ {
+ log.debug( "Moving to Primary Recovery
Mode, failover index = " + i.nextIndex() );
+ }
+ else
+ {
+ log.debug( "No need to connect to
failover, the primary server is back up." );
+ }
}
- }
- allright.set(true);
+ allright.set(true);
- if ( log.isInfoEnabled() )
- {
- log.info( "CONNECTED to host = [" +
rca.getRemoteLocation() + "]" );
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "CONNECTED to host = [" +
rca.getRemoteLocation() + "]" );
+ }
}
}
}
@@ -299,107 +294,108 @@ public class RemoteCacheFailoverRunner<K
RemoteCacheAttributes rca = (RemoteCacheAttributes) rca0.clone();
rca.setRemoteLocation(server);
- RemoteCacheManager rcm = RemoteCacheFactory.getManager( rca, cacheMgr,
- facade.getCacheEventLogger(), facade.getElementSerializer() );
-
- // add a listener if there are none, need to tell rca what number it
- // is at
- ICache<K, V> ic = rcm.getCache( rca );
- // by default the listener id should be 0, else it will be the
- // listener
- // Originally associated with the remote cache. either way is fine.
- // We just don't want the listener id from a failover being used.
- // If the remote server was rebooted this could be a problem if new
- // locals were also added.
+ RemoteCacheManager rcm = RemoteCacheFactory.getManager( rca );
- if ( ic.getStatus() == CacheStatus.ALIVE )
+ if (rcm != null)
{
- try
+ // add a listener if there are none, need to tell rca what number
it
+ // is at
+ ICache<K, V> ic = rcm.getCache( rca );
+ // by default the listener id should be 0, else it will be the
+ // listener
+ // Originally associated with the remote cache. either way is fine.
+ // We just don't want the listener id from a failover being used.
+ // If the remote server was rebooted this could be a problem if new
+ // locals were also added.
+
+ if ( ic.getStatus() == CacheStatus.ALIVE )
{
- // we could have more than one listener registered right
- // now.
- // this will not result in a loop, only duplication
- // stop duplicate listening.
- if ( facade.getPrimaryServer() != null &&
facade.getPrimaryServer().getStatus() == CacheStatus.ALIVE )
+ try
{
- int fidx = rca0.getFailoverIndex();
-
- if ( fidx > 0 )
+ // we could have more than one listener registered right
+ // now.
+ // this will not result in a loop, only duplication
+ // stop duplicate listening.
+ if ( facade.getPrimaryServer() != null &&
facade.getPrimaryServer().getStatus() == CacheStatus.ALIVE )
{
- RemoteLocation serverOld =
rca0.getFailovers().get(fidx);
+ int fidx = rca0.getFailoverIndex();
- if ( log.isDebugEnabled() )
+ if ( fidx > 0 )
{
- log.debug( "Failover Index = " + fidx + " the
server at that index is ["
- + serverOld + "]" );
- }
+ RemoteLocation serverOld =
rca0.getFailovers().get(fidx);
- if ( serverOld != null )
- {
- // create attributes that reflect the
- // previous failed over configuration.
- RemoteCacheAttributes rcaOld =
(RemoteCacheAttributes) rca0.clone();
- rcaOld.setRemoteLocation(serverOld);
- RemoteCacheManager rcmOld =
RemoteCacheFactory.getManager( rcaOld, cacheMgr,
- facade.getCacheEventLogger(),
facade.getElementSerializer() );
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Failover Index = " + fidx + " the
server at that index is ["
+ + serverOld + "]" );
+ }
- if ( rcmOld != null )
+ if ( serverOld != null )
{
- // manager can remove by name if
- // necessary
- rcmOld.removeRemoteCacheListener( rcaOld );
+ // create attributes that reflect the
+ // previous failed over configuration.
+ RemoteCacheAttributes rcaOld =
(RemoteCacheAttributes) rca0.clone();
+ rcaOld.setRemoteLocation(serverOld);
+ RemoteCacheManager rcmOld =
RemoteCacheFactory.getManager( rcaOld );
+
+ if ( rcmOld != null )
+ {
+ // manager can remove by name if
+ // necessary
+ rcmOld.removeRemoteCacheListener( rcaOld );
+ }
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Successfully deregistered from
FAILOVER remote server = "
+ + serverOld );
+ }
}
- if ( log.isInfoEnabled() )
+ }
+ else if ( fidx == 0 )
+ {
+ // this should never happen. If there are no
+ // failovers this shouldn't get called.
+ if ( log.isDebugEnabled() )
{
- log.info( "Successfully deregistered from
FAILOVER remote server = "
- + serverOld );
+ log.debug( "No need to restore primary, it is
already restored." );
+ return true;
}
}
- }
- else if ( fidx == 0 )
- {
- // this should never happen. If there are no
- // failovers this shouldn't get called.
- if ( log.isDebugEnabled() )
+ else if ( fidx < 0 )
{
- log.debug( "No need to restore primary, it is
already restored." );
- return true;
+ // this should never happen
+ log.warn( "Failover index is less than 0, this
shouldn't happen" );
}
}
- else if ( fidx < 0 )
- {
- // this should never happen
- log.warn( "Failover index is less than 0, this
shouldn't happen" );
- }
}
- }
- catch ( IOException e )
- {
- // TODO, should try again, or somehow stop the listener
- log.error("Trouble trying to deregister old failover listener
prior to restoring the primary = "
- + server, e );
- }
+ catch ( IOException e )
+ {
+ // TODO, should try again, or somehow stop the listener
+ log.error("Trouble trying to deregister old failover
listener prior to restoring the primary = "
+ + server, e );
+ }
- // Restore primary
- // may need to do this more gracefully, letting the failover
finish in the background
- RemoteCacheNoWait<K, V> failoverNoWait = facade.getPrimaryServer();
-
- // swap in a new one
- facade.restorePrimaryServer((RemoteCacheNoWait<K, V>) ic);
- rca0.setFailoverIndex( 0 );
+ // Restore primary
+ // may need to do this more gracefully, letting the failover
finish in the background
+ RemoteCacheNoWait<K, V> failoverNoWait =
facade.getPrimaryServer();
- if ( log.isInfoEnabled() )
- {
- String message = "Successfully reconnected to PRIMARY remote
server. Substituted primary for failoverNoWait ["
- + failoverNoWait + "]";
- log.info( message );
+ // swap in a new one
+ facade.restorePrimaryServer((RemoteCacheNoWait<K, V>) ic);
+ rca0.setFailoverIndex( 0 );
- if ( facade.getCacheEventLogger() != null )
+ if ( log.isInfoEnabled() )
{
- facade.getCacheEventLogger().logApplicationEvent(
"RemoteCacheFailoverRunner", "RestoredPrimary", message );
+ String message = "Successfully reconnected to PRIMARY
remote server. Substituted primary for failoverNoWait ["
+ + failoverNoWait + "]";
+ log.info( message );
+
+ if ( facade.getCacheEventLogger() != null )
+ {
+ facade.getCacheEventLogger().logApplicationEvent(
"RemoteCacheFailoverRunner", "RestoredPrimary", message );
+ }
}
+ return true;
}
- return true;
}
// else all right
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListener.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListener.java?rev=1736208&r1=1736207&r2=1736208&view=diff
==============================================================================
---
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListener.java
(original)
+++
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListener.java
Tue Mar 22 16:21:29 2016
@@ -26,6 +26,7 @@ import java.rmi.server.UnicastRemoteObje
import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheConstants;
import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
+import org.apache.commons.jcs.engine.behavior.IElementSerializer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -40,9 +41,6 @@ public class RemoteCacheListener<K, V>
extends AbstractRemoteCacheListener<K, V>
implements IRemoteCacheConstants
{
- /** Don't change */
- private static final long serialVersionUID = 25345252345322345L;
-
/** The logger */
private static final Log log = LogFactory.getLog(
RemoteCacheListener.class );
@@ -55,12 +53,13 @@ public class RemoteCacheListener<K, V>
* The constructor exports this object, making it available to receive
incoming calls. The
* callback port is anonymous unless a local port value was specified in
the configuration.
* <p>
- * @param irca
- * @param cacheMgr
+ * @param irca cache configuration
+ * @param cacheMgr the cache hub
+ * @param elementSerializer a custom serializer
*/
- public RemoteCacheListener( IRemoteCacheAttributes irca,
ICompositeCacheManager cacheMgr )
+ public RemoteCacheListener( IRemoteCacheAttributes irca,
ICompositeCacheManager cacheMgr, IElementSerializer elementSerializer )
{
- super( irca, cacheMgr );
+ super( irca, cacheMgr, elementSerializer );
// Export this remote object to make it available to receive incoming
// calls.
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java?rev=1736208&r1=1736207&r2=1736208&view=diff
==============================================================================
---
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java
(original)
+++
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java
Tue Mar 22 16:21:29 2016
@@ -265,7 +265,7 @@ public class RemoteCacheManager
RemoteCacheListener<K, V> listener = null;
try
{
- listener = new RemoteCacheListener<K, V>( cattr,
cacheMgr );
+ listener = new RemoteCacheListener<K, V>( cattr,
cacheMgr, elementSerializer );
addRemoteCacheListener( cattr, listener );
}
catch ( IOException ioe )
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java?rev=1736208&r1=1736207&r2=1736208&view=diff
==============================================================================
---
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
(original)
+++
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java
Tue Mar 22 16:21:29 2016
@@ -80,8 +80,7 @@ public class RemoteCacheNoWaitFacade<K,
if ( rcnw.getStatus() == CacheStatus.ERROR )
{
// start failover, primary recovery process
- RemoteCacheFailoverRunner<K, V> runner =
- new RemoteCacheFailoverRunner<K, V>( this,
getCompositeCacheManager() );
+ RemoteCacheFailoverRunner<K, V> runner = new
RemoteCacheFailoverRunner<K, V>( this );
runner.setDaemon( true );
runner.start();
runner.notifyError();
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java?rev=1736208&r1=1736207&r2=1736208&view=diff
==============================================================================
---
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java
(original)
+++
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheManager.java
Tue Mar 22 16:21:29 2016
@@ -19,6 +19,9 @@ package org.apache.commons.jcs.auxiliary
* under the License.
*/
+import java.util.HashMap;
+import java.util.Map;
+
import org.apache.commons.jcs.auxiliary.remote.RemoteCacheNoWait;
import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheClient;
@@ -31,9 +34,6 @@ import org.apache.commons.jcs.utils.conf
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* This is a very crude copy of the RMI remote manager. It needs a lot of work!
*/
@@ -172,7 +172,7 @@ public class RemoteHttpCacheManager
remoteCacheNoWait = remoteCacheNoWait2;
if ( remoteCacheNoWait == null )
{
- RemoteHttpClientListener<K, V> listener = new
RemoteHttpClientListener<K, V>( cattr, cacheMgr );
+ RemoteHttpClientListener<K, V> listener = new
RemoteHttpClientListener<K, V>( cattr, cacheMgr, elementSerializer );
IRemoteHttpCacheClient<K, V> remoteService =
createRemoteHttpCacheClientForAttributes( cattr );
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpClientListener.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpClientListener.java?rev=1736208&r1=1736207&r2=1736208&view=diff
==============================================================================
---
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpClientListener.java
(original)
+++
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpClientListener.java
Tue Mar 22 16:21:29 2016
@@ -22,26 +22,25 @@ package org.apache.commons.jcs.auxiliary
import org.apache.commons.jcs.auxiliary.remote.AbstractRemoteCacheListener;
import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
+import org.apache.commons.jcs.engine.behavior.IElementSerializer;
/** Does nothing */
public class RemoteHttpClientListener<K, V>
extends AbstractRemoteCacheListener<K, V>
{
- /** Serial version */
- private static final long serialVersionUID = -9078366610772128010L;
-
/**
* Only need one since it does work for all regions, just reference by
multiple region names.
* <p>
* The constructor exports this object, making it available to receive
incoming calls. The
* callback port is anonymous unless a local port value was specified in
the configuration.
* <p>
- * @param irca
- * @param cacheMgr
+ * @param irca cache configuration
+ * @param cacheMgr the cache hub
+ * @param elementSerializer a custom serializer
*/
- public RemoteHttpClientListener( IRemoteCacheAttributes irca,
ICompositeCacheManager cacheMgr )
+ public RemoteHttpClientListener( IRemoteCacheAttributes irca,
ICompositeCacheManager cacheMgr, IElementSerializer elementSerializer )
{
- super( irca, cacheMgr );
+ super( irca, cacheMgr, elementSerializer );
}
/** Nothing */
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java?rev=1736208&r1=1736207&r2=1736208&view=diff
==============================================================================
---
commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java
(original)
+++
commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheListenerUnitTest.java
Tue Mar 22 16:21:29 2016
@@ -20,6 +20,7 @@ package org.apache.commons.jcs.auxiliary
*/
import junit.framework.TestCase;
+
import org.apache.commons.jcs.auxiliary.remote.behavior.IRemoteCacheAttributes;
import org.apache.commons.jcs.engine.CacheElementSerialized;
import org.apache.commons.jcs.engine.ElementAttributes;
@@ -54,7 +55,7 @@ public class RemoteCacheListenerUnitTest
IRemoteCacheAttributes irca = new RemoteCacheAttributes();
irca.setRemoveUponRemotePut( false );
ICompositeCacheManager cacheMgr = new MockCompositeCacheManager();
- RemoteCacheListener<String, String> listener = new
RemoteCacheListener<String, String>( irca, cacheMgr );
+ RemoteCacheListener<String, String> listener = new
RemoteCacheListener<String, String>( irca, cacheMgr, new StandardSerializer() );
String cacheName = "testName";
String key = "key";
@@ -97,7 +98,7 @@ public class RemoteCacheListenerUnitTest
IRemoteCacheAttributes irca = new RemoteCacheAttributes();
irca.setRemoveUponRemotePut( true );
ICompositeCacheManager cacheMgr = new MockCompositeCacheManager();
- RemoteCacheListener<String, String> listener = new
RemoteCacheListener<String, String>( irca, cacheMgr );
+ RemoteCacheListener<String, String> listener = new
RemoteCacheListener<String, String>( irca, cacheMgr, new StandardSerializer() );
String cacheName = "testName";
String key = "key";