[jboss-cvs] JBossAS SVN: r108431 - projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 4 12:47:02 EDT 2010


Author: pferraro
Date: 2010-10-04 12:47:02 -0400 (Mon, 04 Oct 2010)
New Revision: 108431

Modified:
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManager.java
Log:
Prevent NPEs

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManager.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManager.java	2010-10-04 16:42:38 UTC (rev 108430)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/ispn/DistributedCacheManager.java	2010-10-04 16:47:02 UTC (rev 108431)
@@ -303,7 +303,7 @@
    @Override
    public void removeSession(final String sessionId)
    {
-      log.info(String.format("removeSessionLocal(%s)", sessionId));
+      log.info(String.format("removeSession(%s)", sessionId));
       this.removeSession(sessionId, false);
    }
 
@@ -320,7 +320,6 @@
 
    private void removeSession(final String sessionId, final boolean local)
    {
-      log.info(String.format("removeSession(%s, %s)", sessionId, local));
       Operation<Map<Object, Object>> operation = new Operation<Map<Object, Object>>()
       {
          @Override
@@ -520,20 +519,17 @@
       String sessionId = (String) event.getKey();
       
       Integer version = SessionMapEntry.VERSION.get(map);
-      
-      if (version == null) return;
-      
       Long timestamp = SessionMapEntry.TIMESTAMP.get(map);
-      
-      if (timestamp == null) return;
-      
       DistributableSessionMetadata metadata = SessionMapEntry.METADATA.get(map);
       
-      boolean updated = this.manager.sessionChangedInDistributedCache(sessionId, null, version.intValue(), timestamp.longValue(), metadata);
-      
-      if (!updated)
+      if ((version != null) && (timestamp != null) && (metadata != null))
       {
-         log.warn(String.format("Possible concurrency problem: Replicated version id %d is less than or equal to in-memory version for session %s", version, mask(sessionId))); 
+         boolean updated = this.manager.sessionChangedInDistributedCache(sessionId, null, version.intValue(), timestamp.longValue(), metadata);
+         
+         if (!updated)
+         {
+            log.warn(String.format("Possible concurrency problem: Replicated version id %d is less than or equal to in-memory version for session %s", version, mask(sessionId))); 
+         }
       }
    }
    



More information about the jboss-cvs-commits mailing list