Aaron, the clients do seem to be connected to the server, as the data is being replicated from one client to the other. The logs for the two clients as well as the server are printed below. I've also listed the client class at the end.
The steps that I'm doing are: 1. Add elements 0, 1 and 2 to client 1's cache. (At this point the server's admin servlet showed 3 elements too.) 2. Add element 0 to client 2's cache. 3. Expected Result: Element 0 in Client 1 should be removed. Actual Result: Element 0 in Client 1 gets updated with the latest value. +++++++++++++++++ + Client 1's Logs: +++++++++++++++++ C:\apps\JCS>java -classpath C:\apps\JCS;C:\apps\JCS\com\manh\jcs\dc\client;C:\apps\JCS\lib\commons-logging-1.0.4.jar;C:\apps\JCS\lib\concurrent.j ar;C:\apps\JCS\lib\jcs-1.3.jar;C:\apps\JCS\lib\jcschart-1.1.0.jar com.manh.jcs.dc.client.JCSClient Jul 13, 2009 8:53:09 AM org.apache.jcs.engine.control.CompositeCacheManager configure INFO: Creating cache manager from config file: /cache.ccf Jul 13, 2009 8:53:09 AM org.apache.jcs.utils.threadpool.ThreadPoolManager loadConfig INFO: thread_pool.default PoolConfiguration = useBoundary = [true] boundarySize = [2000] maximumPoolSize = [150] minimumPoolSize = [4] keepAliveT ime = [300000] whenBlockedPolicy = [RUN] startUpSize = [4] Jul 13, 2009 8:53:09 AM org.apache.jcs.engine.control.CompositeCacheConfigurator setDefaultAuxValues INFO: Setting default auxiliaries to RFailover Jul 13, 2009 8:53:09 AM org.apache.jcs.engine.control.CompositeCacheConfigurator setDefaultCompositeCacheAttributes INFO: setting defaultCompositeCacheAttributes to [ useLateral = true, useRemote = true, useDisk = true, maxObjs = 100000, maxSpoolPerRun = -1, di skUsagePattern = 0 ] Jul 13, 2009 8:53:09 AM org.apache.jcs.engine.control.CompositeCacheConfigurator setDefaultElementAttributes INFO: setting defaultElementAttributes to [ IS_LATERAL = false, IS_SPOOL = false, IS_REMOTE = false, IS_ETERNAL = false, MaxLifeSeconds = 21600, IdleTime = 1800, CreateTime = 1247489589828, LastAccessTime = 1247489589828, getTimeToLiveSeconds() = 21600, createTime = 1247489589828 ] Jul 13, 2009 8:53:09 AM org.apache.jcs.engine.memory.lru.LRUMemoryCache initialize INFO: initialized LRUMemoryCache for testCache1 Jul 13, 2009 8:53:09 AM org.apache.jcs.engine.control.CompositeCache <init> INFO: Constructed cache with name [testCache1] and cache attributes [ useLateral = true, useRemote = true, useDisk = true, maxObjs = 100000, maxS poolPerRun = 500, diskUsagePattern = 0 ] Jul 13, 2009 8:53:12 AM org.apache.jcs.auxiliary.remote.RemoteCacheManager addRemoteCacheListener INFO: The remote cache is configured to receive events from the remote server. We will register a listener. Jul 13, 2009 8:53:12 AM org.apache.jcs.engine.control.CompositeCacheConfigurator parseRegions INFO: Parsed regions [testCache1] Jul 13, 2009 8:53:12 AM org.apache.jcs.engine.control.CompositeCacheConfigurator doConfigure INFO: Finished configuration in 3004 ms. Please Enter Command 'P' / 'Q' : +++++++++++++++++++++++++++++++++>>>>>>>>> I am adding elements 0, 1 and 2 here to Client 1. 3 Jul 13, 2009 8:53:20 AM org.apache.jcs.engine.CacheEventQueue put INFO: Cache event queue created: CacheEventQueue [listenerId=2, cacheName=testCache1] Adding 0=522585184 Adding 1=846962689 Adding 2=1378052784 Please Enter Command 'P' / 'Q' : +++++++++++++++++++++++++++++++++>>>>>>>>> I'm printing Client 1's cache contents. (Note the change in element 0's value.) P Key: 0 = 860014859 Key: 1 = 846962689 Key: 2 = 1378052784 Please Enter Command 'P' / 'Q' : +++++++++++++++++++++++++++++++++>>>>>>>>> Quitting the client. Q C:\apps\JCS> +++++++++++++++++ + Client 2's Logs: +++++++++++++++++ C:\apps\JCS>java -classpath C:\apps\JCS;C:\apps\JCS\com\manh\jcs\dc\client;C:\apps\JCS\lib\commons-logging-1.0.4.jar;C:\apps\JCS\lib\concurrent.j ar;C:\apps\JCS\lib\jcs-1.3.jar;C:\apps\JCS\lib\jcschart-1.1.0.jar com.manh.jcs.dc.client.JCSClient Jul 13, 2009 8:53:05 AM org.apache.jcs.engine.control.CompositeCacheManager configure INFO: Creating cache manager from config file: /cache.ccf Jul 13, 2009 8:53:05 AM org.apache.jcs.utils.threadpool.ThreadPoolManager loadConfig INFO: thread_pool.default PoolConfiguration = useBoundary = [true] boundarySize = [2000] maximumPoolSize = [150] minimumPoolSize = [4] keepAliveT ime = [300000] whenBlockedPolicy = [RUN] startUpSize = [4] Jul 13, 2009 8:53:05 AM org.apache.jcs.engine.control.CompositeCacheConfigurator setDefaultAuxValues INFO: Setting default auxiliaries to RFailover Jul 13, 2009 8:53:06 AM org.apache.jcs.engine.control.CompositeCacheConfigurator setDefaultCompositeCacheAttributes INFO: setting defaultCompositeCacheAttributes to [ useLateral = true, useRemote = true, useDisk = true, maxObjs = 100000, maxSpoolPerRun = -1, di skUsagePattern = 0 ] Jul 13, 2009 8:53:06 AM org.apache.jcs.engine.control.CompositeCacheConfigurator setDefaultElementAttributes INFO: setting defaultElementAttributes to [ IS_LATERAL = false, IS_SPOOL = false, IS_REMOTE = false, IS_ETERNAL = false, MaxLifeSeconds = 21600, IdleTime = 1800, CreateTime = 1247489586026, LastAccessTime = 1247489586026, getTimeToLiveSeconds() = 21600, createTime = 1247489586026 ] Jul 13, 2009 8:53:06 AM org.apache.jcs.engine.memory.lru.LRUMemoryCache initialize INFO: initialized LRUMemoryCache for testCache1 Jul 13, 2009 8:53:06 AM org.apache.jcs.engine.control.CompositeCache <init> INFO: Constructed cache with name [testCache1] and cache attributes [ useLateral = true, useRemote = true, useDisk = true, maxObjs = 100000, maxS poolPerRun = 500, diskUsagePattern = 0 ] Jul 13, 2009 8:53:09 AM org.apache.jcs.auxiliary.remote.RemoteCacheManager addRemoteCacheListener INFO: The remote cache is configured to receive events from the remote server. We will register a listener. Jul 13, 2009 8:53:09 AM org.apache.jcs.engine.control.CompositeCacheConfigurator parseRegions INFO: Parsed regions [testCache1] Jul 13, 2009 8:53:09 AM org.apache.jcs.engine.control.CompositeCacheConfigurator doConfigure INFO: Finished configuration in 3349 ms. Please Enter Command 'P' / 'Q' : +++++++++++++++++++++++++++++++++>>>>>>>>> I am adding element 0 to Client 2. 1 Jul 13, 2009 8:53:37 AM org.apache.jcs.engine.CacheEventQueue put INFO: Cache event queue created: CacheEventQueue [listenerId=1, cacheName=testCache1] Adding 0=860014859 Please Enter Command 'P' / 'Q' : +++++++++++++++++++++++++++++++++>>>>>>>>> I am printing Client 2's cache contents. P Key: 0 = 860014859 Please Enter Command 'P' / 'Q' : +++++++++++++++++++++++++++++++++>>>>>>>>> I am quitting from Client 2. Q C:\apps\JCS> +++++++++++++++ + Server's Logs: +++++++++++++++ Jul 13, 2009 8:51:35 AM org.apache.catalina.core.AprLifecycleListener lifecycleE vent INFO: The Apache Tomcat Native library which allows optimal performance in produ ction environments was not found on the java.library.path: C:\IBM\WebSphere\java \jre\bin;.;C:\IBM\WebSphere\java\jre\bin;C:\Program Files\JavaFX\javafx-sdk1.1\b in;C:\Program Files\JavaFX\javafx-sdk1.1\emulator\bin;C:\apps\maven\apache-maven -2.0.10\bin;C:\IBM\WebSphere\java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\ System32\Wbem;C:\PROGRA~1\IBM\CLIENT~1;C:\PROGRA~1\IBM\CLIENT~1\Shared;C:\PROGRA ~1\IBM\CLIENT~1\Emulator;C:\Program Files\Rational\common;c:\program files\borla nd\StarTeam SDK 2005 R2\Lib;c:\program files\borland\StarTeam SDK 2005 R2\Bin;C: \Program Files\jprofiler5\bin\windows;C:\Program Files\Hummingbird\Connectivity\ 11.00\Accessories\;;C:\2008\ant\apache-ant-1.7.1\bin\;C:\jboss-4.2.2.GA\bin;C:\P rogram Files\QuickTime\QTSystem\ Jul 13, 2009 8:51:35 AM org.apache.coyote.http11.Http11BaseProtocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 Jul 13, 2009 8:51:35 AM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 2003 ms Jul 13, 2009 8:51:35 AM org.apache.catalina.core.StandardService start INFO: Starting service Catalina Jul 13, 2009 8:51:35 AM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/5.5.27 Jul 13, 2009 8:51:35 AM org.apache.catalina.core.StandardHost start INFO: XML validation disabled Jul 13, 2009 8:51:40 AM org.apache.jcs.auxiliary.remote.server.RemoteCacheServer Factory startup INFO: ConfigFileName = [/cache.ccf] Jul 13, 2009 8:51:40 AM org.apache.jcs.auxiliary.remote.server.RemoteCacheServer Factory startup INFO: Creating server with these attributes remoteHost = null remotePort = 0 cacheName = null removeUponRemotePut = true getOnly = false allowClusterGet = false localClusterConsistency = false getConfigFileName = /cache.ccf Jul 13, 2009 8:51:40 AM org.apache.jcs.engine.control.CompositeCacheManager getU nconfiguredInstance INFO: Instance is null, creating with provided config Jul 13, 2009 8:51:40 AM org.apache.jcs.engine.control.CompositeCacheManager conf igure INFO: Creating cache manager from config file: /cache.ccf Jul 13, 2009 8:51:40 AM org.apache.jcs.utils.threadpool.ThreadPoolManager loadCo nfig INFO: thread_pool.default PoolConfiguration = useBoundary = [true] boundarySize = [2000] maximumPoolSize = [150] minimumPoolSize = [4] keepAliveTime = [300000] whenBlockedPolicy = [RUN] startUpSize = [4] Jul 13, 2009 8:51:40 AM org.apache.jcs.engine.control.CompositeCacheConfigurator setDefaultAuxValues INFO: Setting default auxiliaries to Jul 13, 2009 8:51:41 AM org.apache.jcs.engine.control.CompositeCacheConfigurator setDefaultCompositeCacheAttributes INFO: setting defaultCompositeCacheAttributes to [ useLateral = true, useRemote = true, useDisk = true, maxObjs = 1000, maxSpoolPerRun = -1, diskUsagePattern = 0 ] Jul 13, 2009 8:51:41 AM org.apache.jcs.engine.control.CompositeCacheConfigurator setDefaultElementAttributes INFO: setting defaultElementAttributes to [ IS_LATERAL = false, IS_SPOOL = false , IS_REMOTE = false, IS_ETERNAL = false, MaxLifeSeconds = 21600, IdleTime = 1800 , CreateTime = 1247489501041, LastAccessTime = 1247489501041, getTimeToLiveSecon ds() = 21599, createTime = 1247489501041 ] Jul 13, 2009 8:51:41 AM org.apache.jcs.engine.memory.lru.LRUMemoryCache initiali ze INFO: initialized LRUMemoryCache for testCache1 Jul 13, 2009 8:51:41 AM org.apache.jcs.engine.control.CompositeCache <init> INFO: Constructed cache with name [testCache1] and cache attributes [ useLateral = true, useRemote = true, useDisk = true, maxObjs = 1000, maxSpoolPerRun = 500, diskUsagePattern = 0 ] Jul 13, 2009 8:51:41 AM org.apache.jcs.engine.control.CompositeCacheConfigurator parseRegions INFO: Parsed regions [testCache1] Jul 13, 2009 8:51:41 AM org.apache.jcs.engine.control.CompositeCacheConfigurator doConfigure INFO: Finished configuration in 125 ms. Jul 13, 2009 8:51:41 AM org.apache.jcs.auxiliary.remote.server.RemoteCacheServer Factory startup INFO: Binding server to 10.0.0.7:1111 with the name org.apache.jcs.auxiliary.rem ote.behavior.IRemoteCacheService Jul 13, 2009 8:51:42 AM org.apache.coyote.http11.Http11BaseProtocol start INFO: Starting Coyote HTTP/1.1 on http-8080 Jul 13, 2009 8:51:43 AM org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 Jul 13, 2009 8:51:43 AM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/94 config=null Jul 13, 2009 8:51:43 AM org.apache.catalina.storeconfig.StoreLoader load INFO: Find registry server-registry.xml at classpath resource Jul 13, 2009 8:51:43 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 8027 ms Jul 13, 2009 8:53:09 AM org.apache.jcs.auxiliary.remote.server.RemoteCacheServer addCacheListener INFO: adding vm listener under new id = [1], listenerAddress [10.0.0.7] Jul 13, 2009 8:53:09 AM org.apache.jcs.auxiliary.remote.server.RemoteCacheServer +++++++++++++++++++++++++++++++++>>>>>>>>> Listener 1 added. addCacheListener INFO: Region testCache1's listener size = 1 Jul 13, 2009 8:53:12 AM org.apache.jcs.auxiliary.remote.server.RemoteCacheServer addCacheListener INFO: adding vm listener under new id = [2], listenerAddress [10.0.0.7] Jul 13, 2009 8:53:12 AM org.apache.jcs.auxiliary.remote.server.RemoteCacheServer +++++++++++++++++++++++++++++++++>>>>>>>>> Listener 2 added. addCacheListener INFO: Region testCache1's listener size = 2 Jul 13, 2009 8:53:20 AM org.apache.jcs.engine.CacheEventQueue put INFO: Cache event queue created: CacheEventQueue [listenerId=1, cacheName=testCa che1] Jul 13, 2009 8:53:37 AM org.apache.jcs.engine.CacheEventQueue put INFO: Cache event queue created: CacheEventQueue [listenerId=2, cacheName=testCa che1] +++++++++++++++++++++++++++++++++++++++ + Also, my client class looks like this: +++++++++++++++++++++++++++++++++++++++ package com.manh.jcs.dc.client; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Random; import org.apache.jcs.JCS; import org.apache.jcs.access.exception.CacheException; public class JCSClient { private static final String cacheRegionName = "testCache1"; private JCS cache = null; private static int keyCount = 0; public JCSClient() { try { setCache( JCS.getInstance( cacheRegionName ) ); } catch ( CacheException e ) { System.out.println( "Problem initializing cache for region name [" + cacheRegionName + "]"); } } /** * @param args */ public static void main(String[] args) { JCSClient test = new JCSClient(); try { test.displayCacheContent(); } catch (Exception e) { e.printStackTrace(); } } public void displayCacheContent() throws CacheException { // Create BufferedReader object from Standard input device. // Standard input device is typically a keyborad. BufferedReader dataIn = new BufferedReader(new InputStreamReader( System.in) ); // Prompt a user to enter P for Print, Q for Quit and a number for entering data into the cache. String name = ""; while (!"Q".equals(name)) { System.out.println("Please Enter Command 'P' / 'Q' :"); try{ name = dataIn.readLine(); }catch( IOException e ){ System.out.println("Error!"); } int i=0; if ("P".equalsIgnoreCase(name)) { while (i<keyCount) { String value = (String)cache.get(String.valueOf(i)); if (value == null) break; System.out.println("Key: " + i + " = " + value); i++; } } else if (name != null) { int size = 0; try { size = Integer.parseInt(name); keyCount = size; int key = 0; Random r = new Random(); for (key=0; key < size; key++) { int randint = Math.abs(r.nextInt()); cache.put(String.valueOf(key), String.valueOf(key + randint)); System.out.println("Adding " + key + "=" + (key + randint)); } } catch (Exception e) { if (name.equals("Q")) { System.exit(-1); } else continue; } } } } public JCS getCache() { return cache; } public void setCache(JCS cache) { this.cache = cache; } } Thanks, Avanti -----Original Message----- From: Aaron Smuts [mailto:asm...@yahoo.com] Sent: Sunday, July 12, 2009 7:19 PM To: JCS Users List Subject: Re: RemoveUponRemotePut not working. Are you sure that the client is connected to the server? The server logs should indicate a connection. And the client status should not be in error. Aaron --- On Fri, 7/10/09, Avanti Nagalia <anaga...@manh.com> wrote: > From: Avanti Nagalia <anaga...@manh.com> > Subject: RemoveUponRemotePut not working. > To: jcs-users@jakarta.apache.org > Date: Friday, July 10, 2009, 1:16 PM > I'm trying a POC for synching local > caches in a cluster. I'm using JCS > Remote Cache server for the same. I have set up the server > in Tomcat on > my local box and am running two clients on my local machine > as well. I > would like to enable data invalidation instead of data > replication > across the clients, hence have set the property > RemoveUponRemotePut to > true. What I understand from this property is that if a > cache element is > present on both clients and client1 updates its local copy, > then a > remove request will be issued for client2 so that the next > request for > that element will force client2 to go to the DB to retrieve > a fresh copy > of the element, hence maintaining cache coherence across > the cluster. > > > > What I have instead found, is that irrespective of whether > RemoveUponRemotePut is set to true or false, the behavior > is as follows: > > 1. Add element to Client1 . > > 2. Add element to Client2. > > 3. Update element in > Client1. > > Result - The element in Client2 also gets updated with the > new value. - > This is not desired, I'd like the element to be removed > from Client2's > cache at this point, instead of the element being > replicated in > client2's cache. > > > > My configuration files (both server and client) are listed > below. Could > you please point out what I'm making a mistake with. I > tried setting the > value to true and to false and I still get the same > behavior for both > settings. > > > > Thanks, > > Avanti > > > > My client CCF file looks as follows: > > # DEFAULT CACHE REGION > > jcs.default=RFailover > > jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttribut > es > > jcs.default.cacheattributes.MaxObjects=100000 > > jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory > .lru.LRUMemoryCache > > jcs.default.cacheattributes.UseMemoryShrinker=false > > jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600 > > jcs.default.cacheattributes.ShrinkerIntervalSeconds=60 > > jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes > > jcs.default.elementattributes.IsEternal=false > > jcs.default.elementattributes.MaxLifeSeconds=21600 > > jcs.default.elementattributes.IdleTime=1800 > > jcs.default.elementattributes.IsSpool=false > > jcs.default.elementattributes.IsRemote=false > > jcs.default.elementattributes.IsLateral=false > > > > # PRE-DEFINED CACHE REGIONS > > jcs.region.testCache1=RFailover > > jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCac > heAttributes > > jcs.region.testCache1.cacheattributes.MaxObjects=100000 > > jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.jcs.eng > ine.memory.lru.LRUMemoryCache > > jcs.region.testCache1.cacheattributes.UseMemoryShrinker=false > > jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=3600 > > jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=60 > > jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500 > > jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAtt > ributes > > jcs.region.testCache1.elementattributes.IsEternal=false > > > > # Remote RMI Cache set up to failover > > jcs.auxiliary.RFailover=org.apache.jcs.auxiliary.remote.RemoteCacheFacto > ry > > jcs.auxiliary.RFailover.attributes=org.apache.jcs.auxiliary.remote.Remot > eCacheAttributes > > jcs.auxiliary.RFailover.attributes.FailoverServers=localhost:1111 > > jcs.auxiliary.RFailover.attributes.RemoveUponRemotePut=true > > jcs.auxiliary.RFailover.attributes.GetOnly=false > > > > The server's cache.ccf file looks as follows: > > registry.host=localhost > > registry.port=1111 > > remote.cache.service.port=1111 > > remote.cache.rmiSocketFactoryTimeoutMillis=5000 > > remote.cluster.LocalClusterConsistency=false > > remote.cluster.AllowClusterGet=false > > # > > # DEFAULT CACHE REGION > > jcs.default= > > jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttribut > es > > jcs.default.cacheattributes.MaxObjects=1000 > > jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory > .lru.LRUMemoryCache > > jcs.default.cacheattributes.UseMemoryShrinker=false > > jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600 > > jcs.default.cacheattributes.ShrinkerIntervalSeconds=60 > > jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes > > jcs.default.elementattributes.IsEternal=false > > jcs.default.elementattributes.MaxLifeSeconds=21600 > > jcs.default.elementattributes.IdleTime=1800 > > jcs.default.elementattributes.IsSpool=false > > jcs.default.elementattributes.IsRemote=false > > jcs.default.elementattributes.IsLateral=false > > # > > # PRE-DEFINED CACHE REGIONS > > jcs.region.testCache1= > > jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCac > heAttributes > > jcs.region.testCache1.cacheattributes.MaxObjects=1000 > > jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.jcs.eng > ine.memory.lru.LRUMemoryCache > > jcs.region.testCache1.cacheattributes.UseMemoryShrinker=false > > jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=3600 > > jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=60 > > jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500 > > jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAtt > ributes > > jcs.region.testCache1.elementattributes.IsEternal=false > > jcs.region.testCache1.elementattributes.IsSpool=false > > jcs.region.testCache1.elementattributes.IsRemote=false > > jcs.region.testCache1.elementattributes.IsLateral=false > > jcs.region.testCache1.elementattributes.IdleTime=1800 > > jcs.region.testCache1.elementattributes.MaxLifeSeconds=21600 > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: jcs-users-unsubscr...@jakarta.apache.org For additional commands, e-mail: jcs-users-h...@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: jcs-users-unsubscr...@jakarta.apache.org For additional commands, e-mail: jcs-users-h...@jakarta.apache.org