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