129         boolean replaced = 
false;
   130         int replaceRetries = 0;
   131         int sleepInterval = 25;
   135             SessionEntityWrapper<V> localEntityWrapper = 
cache.get(key);
   136             VersionedValue<SessionEntityWrapper<V>> remoteSessionVersioned = 
remoteCache.getWithMetadata(key);
   139             if (remoteSessionVersioned == null || remoteSessionVersioned.getValue() == null) {
   140                 logger.debugf(
"Entity '%s' not present in remoteCache. Ignoring replace",
   145             if (remoteSessionVersioned.getVersion() < eventVersion) {
   147                     logger.debugf(
"Got replace remote entity event prematurely for entity '%s', will try again. Event version: %d, got: %d",
   148                       key.toString(), eventVersion, remoteSessionVersioned == null ? -1 : remoteSessionVersioned.getVersion());
   149                     Thread.sleep(
new Random().nextInt(sleepInterval));  
   151                 } 
catch (InterruptedException ex) {
   154                     sleepInterval = sleepInterval << 1;
   157             SessionEntity remoteSession = remoteSessionVersioned.getValue().getEntity();
   159             logger.debugf(
"Read session entity from the remote cache: %s . replaceRetries=%d", remoteSession.toString(), replaceRetries);
   161             SessionEntityWrapper<V> sessionWrapper = remoteSession.mergeRemoteEntityWithLocalEntity(localEntityWrapper);
   164             replaced = 
cache.getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE, Flag.SKIP_CACHE_LOAD, Flag.IGNORE_RETURN_VALUES)
   165                     .replace(key, localEntityWrapper, sessionWrapper);
   168                 logger.debugf(
"Did not succeed in merging sessions, will try again: %s", remoteSession.toString());
 static final int MAXIMUM_REPLACE_RETRIES
Definition: RemoteCacheSessionListener.java:50
 
Cache< K, SessionEntityWrapper< V > > cache
Definition: RemoteCacheSessionListener.java:52
 
static final Logger logger
Definition: RemoteCacheSessionListener.java:48
 
RemoteCache< K, SessionEntityWrapper< V > > remoteCache
Definition: RemoteCacheSessionListener.java:53