[jboss-cvs] JBossAS SVN: r80123 - projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/cache/simple.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 27 17:26:52 EDT 2008


Author: ALRubinger
Date: 2008-10-27 17:26:52 -0400 (Mon, 27 Oct 2008)
New Revision: 80123

Modified:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/cache/simple/SimpleStatefulCache.java
Log:
[EJBTHREE-1549] Autoformat only

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/cache/simple/SimpleStatefulCache.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/cache/simple/SimpleStatefulCache.java	2008-10-27 21:22:06 UTC (rev 80122)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/cache/simple/SimpleStatefulCache.java	2008-10-27 21:26:52 UTC (rev 80123)
@@ -177,7 +177,7 @@
       {
          super(name);
       }
-      
+
       public void block() throws InterruptedException
       {
          Thread.sleep(sessionTimeout * 1000);
@@ -198,7 +198,7 @@
             }
             try
             {
-               
+
                /*
                 * EJBTHREE-1549
                 * 
@@ -207,95 +207,94 @@
                 * perform passivation on the unpublished 
                 * local stack variable copy
                 */
-               
+
                // Initialize
                CacheMap newMap = null;
-               
+
                // Copy the contents of the internal map
-               synchronized(cacheMap)
+               synchronized (cacheMap)
                {
                   newMap = new CacheMap(cacheMap);
                }
-               
+
                /*
                 * End EJBTHREE-1549
                 */
 
-                  if (!running) return;
-                  
-                  boolean trace = log.isTraceEnabled();
-                  Iterator it = newMap.entrySet().iterator();
-                  long now = System.currentTimeMillis();
-                  while (it.hasNext())
+               if (!running)
+                  return;
+
+               boolean trace = log.isTraceEnabled();
+               Iterator it = newMap.entrySet().iterator();
+               long now = System.currentTimeMillis();
+               while (it.hasNext())
+               {
+                  Map.Entry entry = (Map.Entry) it.next();
+                  StatefulBeanContext centry = (StatefulBeanContext) entry.getValue();
+                  if (now - centry.lastUsed >= sessionTimeout * 1000)
                   {
-                     Map.Entry entry = (Map.Entry) it.next();
-                     StatefulBeanContext centry = (StatefulBeanContext) entry.getValue();
-                     if (now - centry.lastUsed >= sessionTimeout * 1000)
+                     synchronized (centry)
                      {
-                        synchronized (centry)
-                        {                     
-                           if (centry.getCanPassivate())
+                        if (centry.getCanPassivate())
+                        {
+                           if (!centry.getCanRemoveFromCache())
                            {
-                              if (!centry.getCanRemoveFromCache())
-                              {
-                                 passivate(centry);
-                              }
-                              else if (trace)
-                              {
-                                 log.trace("Removing " + entry.getKey() + " from cache");
-                              }
+                              passivate(centry);
                            }
-                           else
+                           else if (trace)
                            {
-                              centry.markedForPassivation = true;                              
-                              assert centry.isInUse() : centry + " is not in use, and thus will never be passivated";
+                              log.trace("Removing " + entry.getKey() + " from cache");
                            }
-                           
-                           
-                           // its ok to evict because it will be passivated
-                           // or we determined above that we can remove it
-                           
-                           // Remove from the copy
-                           it.remove();
-                           
-                           /*
-                            * EJBTHREE-1549
-                            */
-                           
-                           // Remove from the internal cacheMap
-                           
-                           Object removed = null;
-                           Object key = entry.getKey();
-                           synchronized (cacheMap)
-                           {
-                              removed = cacheMap.remove(key);
-                           }
-   
-                           // Perform some assertions
-                           assert removed != null : "Could not remove key " + key
-                                 + " from internal cacheMap as there was no corresponding entry";
-                           assert removed == centry : "Removed " + removed
-                                 + " from internal cacheMap did not match the object we were expecting: " + centry;
-                           
-                           /*
-                            * End EJBTHREE-1549
-                            */
                         }
+                        else
+                        {
+                           centry.markedForPassivation = true;
+                           assert centry.isInUse() : centry + " is not in use, and thus will never be passivated";
+                        }
+
+                        // its ok to evict because it will be passivated
+                        // or we determined above that we can remove it
+
+                        // Remove from the copy
+                        it.remove();
+
+                        /*
+                         * EJBTHREE-1549
+                         */
+
+                        // Remove from the internal cacheMap
+                        Object removed = null;
+                        Object key = entry.getKey();
+                        synchronized (cacheMap)
+                        {
+                           removed = cacheMap.remove(key);
+                        }
+
+                        // Perform some assertions
+                        assert removed != null : "Could not remove key " + key
+                              + " from internal cacheMap as there was no corresponding entry";
+                        assert removed == centry : "Removed " + removed
+                              + " from internal cacheMap did not match the object we were expecting: " + centry;
+
+                        /*
+                         * End EJBTHREE-1549
+                         */
                      }
-                     else if (trace)
-                     {
-                        log.trace("Not passivating; id=" + centry.getId() +
-                              " only inactive " + Math.max(0, now - centry.lastUsed) + " ms");
-                     }
                   }
+                  else if (trace)
+                  {
+                     log.trace("Not passivating; id=" + centry.getId() + " only inactive "
+                           + Math.max(0, now - centry.lastUsed) + " ms");
+                  }
                }
-            
+            }
+
             catch (Exception ex)
             {
                log.error("problem passivation thread", ex);
             }
+         }
       }
-      }
    }
 
    public void initialize(EJBContainer container) throws Exception




More information about the jboss-cvs-commits mailing list