jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Smuts <asm...@yahoo.com>
Subject Re: Error in RC cache when server restarts
Date Tue, 12 Jan 2010 03:04:13 GMT
If the clients put items to the cache, they should recognize that they are no longer connected.
 They will then reconnect.  If the clients merely listen, I'm not sure what will happen. 
Let me look into this.  We may need to add a periodic connection test.

Aaron

--- On Tue, 12/22/09, Kevin <kevin_mic@yahoo.com> wrote:

> From: Kevin <kevin_mic@yahoo.com>
> Subject: Error in RC cache when server restarts
> To: jcs-users@jakarta.apache.org
> Date: Tuesday, December 22, 2009, 3:13 PM
> There is an error in the RC cache
> when the server goes through a restart.  Basically the
> problem is associated with the listenerId given to
> clients.  When the server starts up it initializes that
> listenerId to 0.  As clients connect they are given a
> listenerId and an event queue is created to handle sending
> changes to the client.    The problem occurs when the
> server restarts.  On restart the server resets its
> listenerId sequence.  Clients that reconnect are allowed to
> continue using their listenerId.  When new clients connect
> the server does not check to see if the listenerId it is
> assigning out is in conflict with an existing listenerid. 
> Also when previous clients reconnect the server does not
> check to see if it has given out the listenerid that the
> reconnecting client is using.
> 
> What you end up with is one or more clients that never
> receive updates from the server.
> 
> Has anyone else experienced this bug and is there a
> workaround or a fix to it?
> 
> Here is the snippet of code I am looking at.  It comes
> from
> org.apache.jcs.auxiliary.remote.server.RemoteCacheServer.addCacheListener
> 
> 
>  // synchronized ( listenerId )
>         synchronized ( ICacheListener.class )
>         {
>             long id = 0;
>             try
>             {
>                 id =
> listener.getListenerId();
>                 // clients problably
> shouldn't do this.
>                 if ( id == 0 )
>                 {
>                     // must start at one
> so the next gets recognized
>                     long listenerIdB =
> nextListenerId();
>                     if (
> log.isDebugEnabled() )
>                     {
>                         log.debug(
> "listener id=" + ( listenerIdB & 0xff ) + " addded for
> cache [" + cacheName
>                             +
> "], listenerAddress [" + listenerAddress + "]" );
>                     }
>                    
> listener.setListenerId( listenerIdB );
>                     id = listenerIdB;
> 
>                     // in case it needs
> synchronization
>                     if (
> log.isInfoEnabled() )
>                     {
>                         log.info(
> "adding vm listener under new id = [" + listenerIdB + "],
> listenerAddress ["
>                             +
> listenerAddress + "]" );
>                     }
>                 }
>                 else
>                 {
>                     if (
> log.isInfoEnabled() )
>                     {
>                         log.info(
> "adding listener under existing id = [" + id + "],
> listenerAddress ["
>                             +
> listenerAddress + "]" );
>                     }
>                     // should confirm
> the the host is the same as we have on
>                     // record, just in
> case a client has made a mistake.
>                 }
> 
>                 // relate the type to an id
>                 this.idTypeMap.put( new
> Long( id ), new Integer( remoteType ) );
>             }
>             catch ( IOException ioe )
>             {
>                 log.error( "Problem setting
> listener id, listenerAddress [" + listenerAddress + "]", ioe
> );
>             }
> 
>             CacheEventQueueFactory fact = new
> CacheEventQueueFactory();
>             ICacheEventQueue q =
> fact.createCacheEventQueue( listener, id, cacheName,
> rcsa.getEventQueuePoolName(),
>                                                             
> rcsa.getEventQueueTypeFactoryCode() );
> 
>             eventQMap.put( new Long(
> listener.getListenerId() ), q );
> 
> 
> 
> 
> 
>       

---------------------------------------------------------------------
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