jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Narendra Verma <Narendra.Ve...@symphonysv.com>
Subject RE: Need Help on JCS Remote Cache
Date Fri, 30 Dec 2011 06:12:22 GMT
Hi Al,

Thanks for your reply.

Actually, I made a remote cache POC, and tried running in windows environment. Which works
perfectly. 

I Had two clients and one server on windows boxes: 

Windows Box1: Client1
Windows Box2: Client2 and Remote Cache Server

In this case, with same test program (given below in same mail thread), client1 puts object
on remote server and client2 reads it, then change it then after client-1 picks updated object
again.


The problem is being faced only in Linux environment.

Linux Box1: Client1
Linux Box2: Client2 and Remote Cache Server

Scenario-1:

When I put object from client-2 and access it in client-1, it is fetched successfully. But
when I update it in client-1 and pushed it again then clien-2 does not access the object with
same ID. Even when I try again to access it from client-1, null pointer exception comes. 

Scenario-2:

When I put object from client-1 and access it in client-2, it never fetched. 


What I interpreted, the core problem in putting data through client-1 which is running on
remote machine. Why this is happening? Need experts help. 


Thanks & Regards,
Narendra Verma

-----Original Message-----
From: Alistair Forbes [mailto:alistair.forbes@2e-systems.com] 
Sent: Friday, December 30, 2011 1:46 AM
To: JCS Users List
Subject: Re: Need Help on JCS Remote Cache

Hi Narendra,

Try checking out the source code - the unit tests cover pretty much all 
test cases.

I did not look at your problem in detail, but it looks like you are 
assuming that you would get back references to objects. Anything that 
goes remote is a copy of the original object - so no remote objects.

Regards
Al

On 12/28/2011 02:49 PM, Narendra Verma wrote:
> Thanks Thomas.
>
> Thanks&  Regards,
> Narendra Verma
>
>
> -----Original Message-----
> From: Thomas Vandahl [mailto:tv@apache.org]
> Sent: Wednesday, December 28, 2011 7:17 PM
> To: Commons Users List
> Cc: JCS Users List
> Subject: Re: Need Help on JCS Remote Cache
>
> On 26.12.11 09:11, Narendra Verma wrote:
>> Hi All,
>>
>> I have made setup of JCS in my Linux environment and trying to make a POC using Remote
Cache.
> I cannot help you much with this problem. Just a hint that the users
> list for JCS changed to user@commons.apache.org. I redirected your
> message to there.
>
> Bye, Thomas.
>
>
>> My System Setup:
>>
>>
>> *         RMI Server : Running on 10.55.164.215 (using RMI Start up Servlet)
>>
>> *         Client-1: Running on box 10.55.164.215 on same machine where serer is running
>>
>> *         Client-2: Running on box 10.55.164.45
>>
>>
>> My Configuration Files:
>>
>> *         Server Configuration
>>
>>
>> # ----------------------------------------------
>> # Registry used to register and provide the
>> # IRemoteCacheService service.
>> registry.host=10.55.164.215
>> registry.port=1102
>> # call back port to local caches.
>> remote.cache.service.port=1102
>> # rmi socket factory timeout
>> remote.cache.rmiSocketFactoryTimeoutMillis=5000
>> # cluster setting
>> remote.cluster.LocalClusterConsistency=false
>> remote.cluster.AllowClusterGet=false
>> # ----------------------------------------------
>>
>> # DEFAULT CACHE REGION
>> jcs.default=
>> jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
>> jcs.default.cacheattributes.MaxObjects=1000
>> jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
>>
>> # PRE-DEFINED CACHE REGIONS
>> jcs.region.userCache=
>> jcs.region.userCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
>> jcs.region.userCache.cacheattributes.MaxObjects=1000
>> jcs.region.userCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
>> jcs.region.userCache.cacheattributes.UseMemoryShrinker=false
>> jcs.region.userCache.cacheattributes.MaxMemoryIdleTimeSeconds=3600
>> jcs.region.userCache.cacheattributes.ShrinkerIntervalSeconds=60
>> jcs.region.userCache.cacheattributes.MaxSpoolPerRun=500
>> jcs.region.userCache.elementattributes=org.apache.jcs.engine.ElementAttributes
>> jcs.region.userCache.elementattributes.IsEternal=false
>>
>>
>>
>>
>>
>>
>> *         Client-1 and Client-2  Configuration at separate boxes - See the above
in System Setup Section
>> # DEFAULT CACHE REGION
>> # sets the default aux value for any non configured caches
>> jcs.default=RC
>> jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
>> jcs.default.cacheattributes.MaxObjects=1000
>> jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
>> jcs.default.elementattributes.IsEternal=false
>> jcs.default.elementattributes.MaxLifeSeconds=3600
>> jcs.default.elementattributes.IdleTime=1800
>> jcs.default.elementattributes.IsSpool=true
>> jcs.default.elementattributes.IsRemote=true
>> jcs.default.elementattributes.IsLateral=false
>>
>> # CACHE REGIONS AVAILABLE
>>
>> # Regions preconfigured for caching
>> jcs.region.userCache=RC
>> jcs.region.userCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
>> jcs.region.userCache.cacheattributes.MaxObjects=1200
>> jcs.region.userCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
>> jcs.region.userCache.elementattributes.IsEternal=false
>> jcs.region.userCache.elementattributes.MaxLifeSeconds=7200
>> jcs.region.userCache.elementattributes.IdleTime=1800
>> jcs.region.userCache.elementattributes.IsSpool=true
>> jcs.region.userCache.elementattributes.IsRemote=true
>> jcs.region.userCache.elementattributes.IsLateral=false
>>
>> # Remote RMI Cache set up to failover
>> # This remote client does not receive
>> jcs.auxiliary.RC=org.apache.jcs.auxiliary.remote.RemoteCacheFactory
>> jcs.auxiliary.RC.attributes=org.apache.jcs.auxiliary.remote.RemoteCacheAttributes
>> jcs.auxiliary.RC.attributes.FailoverServers=10.55.164.215:1102
>> jcs.auxiliary.RC.attributes.LocalPort=1202
>> jcs.auxiliary.RC.attributes.RemoveUponRemotePut=true
>> jcs.auxiliary.RC.attributes.RmiSocketFactoryTimeoutMillis=5000
>> jcs.auxiliary.RC.attributes.GetOnly=false
>> jcs.auxiliary.RC.attributes.Receive=true
>>
>>
>>
>>
>>
>>
>>
>> Client Test Programs:
>>
>> Input parameters  while running client-1 : java com.brightsky.util.JCSTest  /cache-client1.ccf
>> Input parameters  while running client-2 : java com.brightsky.util.JCSTest  /cache.ccf-client1
>>
>>
>> package com.brightsky.util;
>> import java.util.Date;
>>
>> /*
>>   * This code is property of BrightSky, Inc. Use, duplication and disclosure
>>   * in any form without permission of copyright holder is prohibited.
>>   *
>>   * (C) Copyright BrightSky, Inc. 2011. All rights reserved.
>>   */
>>
>> /**
>>   * @author nverma
>>   *
>>   */
>> public class JCSTest {
>>      public static void main(String a[]) throws InterruptedException {
>>
>>          System.out.println("\n =======================================================================================\n"
);
>>          System.out.println("\n =================================== QA Node - "+a[0]+
"================================\n" );
>>          System.out.println("\n =======================================================================================\n"
);
>>
>>          System.out.println("\n ----------------------------------Initializing JCS....\n"
);
>>
>>
>>          CacheManager cm = CacheManager.getInstance(a[0]);
>>
>>          System.out.println("\n ----------------------------------Initialized Successfully.\n"
);
>>
>>          int userId = 1;
>>          int notificationCount = 10 ;
>>          int loopCount = 5 ;
>>          int threadSleepSec = 2 ;
>>
>>
>>          userId = 1;
>>          notificationCount =10;
>>          loopCount =5;
>>          threadSleepSec =2;
>>
>>          UserCacheObj userObject;
>>          // If no, then write and fetch in loop
>>          // if yes, no write only fetch object of passed userid
>>          if("no".equals(a[6])){
>>
>>              // Create Object
>>              userObject = new UserCacheObj();
>>              userObject.setUserId(userId);
>>              userObject.setNotificationCount(notificationCount);
>>
>>              System.out.println("\n ----------------------------------Storing object
into cache....\n" );
>>              // Store the object into cache
>>              cm.storeUserbj(userObject);
>>
>>              System.out.println("\n ----------------------------------Stored Successfully.\n"
);
>>
>>          }
>>
>>
>>          System.out.println("\n ---------------Starting loop to fetch and increment
notification count for userId ["+userId+"] .....\n" );
>>
>>          for(int i=1; i<=loopCount; i++){
>>
>>              System.out.println("\n -----------[Attemp : "+i+"] \n" );
>>
>>              Date date = new Date();
>>
>>              userObject = cm.getUserObj(userId);
>>
>>              System.out.println("\n ----------- ["+date+"] Fetched Notification Count
= "+userObject.getNotificationCount());
>>
>>              int notificationCnt = userObject.getNotificationCount() + 1;
>>
>>              userObject.setNotificationCount(notificationCnt);
>>
>>              date = new Date();
>>
>>              System.out.println("\n ----------- Incremented notification count ["+notificationCnt+"]
");
>>
>>              cm.storeUserbj(userObject);
>>
>>              System.out.println("\n ----------- ... ["+date+"] Pushed to updated
object ");
>>
>>
>>              Thread.sleep(1000 * threadSleepSec);
>>
>>          }
>>
>>          System.out.println("\n ----------- Loop End.   !!!! Good Bye !!!!\n" );
>>
>>      }
>> }
>>
>>
>>
>> Question and Problem:
>>
>> When I put any object from either client-1 or client-2 then server shows log that
it is creating listener for corresponding clients. And event is put successfully.
>>
>> Server logs on Client-1 Run
>>
>> 2011-12-25 15:46:12,801 INFO  [org.apache.jcs.auxiliary.remote.server.RemoteCacheServer]
(RMI TCP Connection(78)-10.55.164.145) adding vm listener under new id = [46], listenerAddress
[127.0.0.1]
>> 2011-12-25 15:46:12,801 INFO  [org.apache.jcs.auxiliary.remote.server.RemoteCacheServer]
(RMI TCP Connection(78)-10.55.164.145) Region userCache's listener size = 2
>>
>> Server logs on Client-2 Run
>>
>> 2011-12-25 16:04:11,509 INFO  [org.apache.jcs.auxiliary.remote.server.RemoteCacheServer]
(RMI TCP Connection(91)-10.55.164.215) adding vm listener under new id = [48], listenerAddress
[10.55.164.215]
>> 2011-12-25 16:04:11,509 INFO  [org.apache.jcs.auxiliary.remote.server.RemoteCacheServer]
(RMI TCP Connection(91)-10.55.164.215) Region userCache's listener size = 3
>>
>>
>> Scenario-1:
>> When I put object from client-2 and access it in client-1, it is fetched successfully.
But when I update it in client-1 and pushed it again then clien-2 does not access the object
with same ID and null pointer exception comes. Event when I try to access it again with client-1
again null pointer exception comes. Need to confirm why object is not accessible after updating
by any of the client?
>>
>> Scenario-2:
>> When I put object from client-1 and access it in client-2, it never fetched. Need
to confirm why client-2 never access the object put by the client-1? Where client-1 access
once if client-2 puts.
>>
>>
>> Please help/guide me to resolve these issues.
>>
>> Thanks&  Regards,
>> Narendra Verma
>>
>>
>> ________________________________
>> NOTICE TO RECIPIENT: THIS E-MAIL (INCLUDING ANY ATTACHMENTS) IS MEANT FOR ONLY THE
INTENDED RECIPIENT OF THE TRANSMISSION, MAY CONTAIN CONFIDENTIAL INFORMATION, AND IS PROTECTED
BY LAW. IF YOU RECEIVED THIS E-MAIL IN ERROR, PLEASE IMMEDIATELY NOTIFY THE SENDER OF THE
ERROR BY RETURN E-MAIL, DELETE THIS COMMUNICATION AND SHRED ANY ATTACHMENTS. UNAUTHORIZED
REVIEW, USE, DISSEMINATION, DISTRIBUTION, COPYING OR TAKING OF ANY ACTION BASED ON THIS COMMUNICATION
IS STRICTLY PROHIBITED.
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
>


-- 

Alistair Forbes
2e Systems

Tel: +49 - 6196 - 95058 17 Fax: +49 - 6196 - 95058 94
E-mail: alistair.forbes@2e-systems.com

Address: 2e Systems GmbH,  Koenigsteiner Str. 87, 65812 Bad Soden am Taunus
Company registration: Amtsgericht Koenigstein (Germany), HRB 7303
Directors: Philip Douglas, Alistair Forbes

http://www.2e-systems.com - making your business fly!



---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Mime
View raw message