[jboss-cvs] JBossAS SVN: r88746 - branches/Branch_5_x/server/src/main/org/jboss/ejb/plugins.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 12 11:43:31 EDT 2009


Author: anil.saldhana at jboss.com
Date: 2009-05-12 11:43:30 -0400 (Tue, 12 May 2009)
New Revision: 88746

Modified:
   branches/Branch_5_x/server/src/main/org/jboss/ejb/plugins/PerTxEntityInstanceCache.java
Log:
JBAS-6894: introduce priv blocks

Modified: branches/Branch_5_x/server/src/main/org/jboss/ejb/plugins/PerTxEntityInstanceCache.java
===================================================================
--- branches/Branch_5_x/server/src/main/org/jboss/ejb/plugins/PerTxEntityInstanceCache.java	2009-05-12 15:40:41 UTC (rev 88745)
+++ branches/Branch_5_x/server/src/main/org/jboss/ejb/plugins/PerTxEntityInstanceCache.java	2009-05-12 15:43:30 UTC (rev 88746)
@@ -33,6 +33,8 @@
 
 import java.rmi.RemoteException;
 import java.rmi.NoSuchObjectException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -216,25 +218,33 @@
       return container.getLockManager().canPassivate(key);
    }
 
-   protected void removeTimerServiceIfAllCancelledOrExpired(Object id)
+   protected void removeTimerServiceIfAllCancelledOrExpired(final Object id)
    {
-      boolean trace = log.isTraceEnabled();
+      final boolean trace = log.isTraceEnabled();
       if (trace)
       {
          log.trace("Check whether all timers are cancelled or expired for this entity: " + id);
       }
-      EJBTimerService service = container.getTimerService();
-      ObjectName containerId = container.getJmxName();
-      TimerService timerService = service.getTimerService(containerId, id);
-      if (timerService != null && timerService.getTimers().isEmpty())
+      final EJBTimerService service = container.getTimerService();
+      final ObjectName containerId = container.getJmxName();
+      
+      AccessController.doPrivileged(new PrivilegedAction<Object>()
       {
-         // Assuming that active timers do not include cancelled or expired ones.
-         if (trace)
+         public Object run()
          {
-            log.trace("No active timers available for " + containerId + " and primary key " + id);
+            TimerService timerService = service.getTimerService(containerId, id);
+            if (timerService != null && timerService.getTimers().isEmpty())
+            {
+               // Assuming that active timers do not include cancelled or expired ones.
+               if (trace)
+               {
+                  log.trace("No active timers available for " + containerId + " and primary key " + id);
+               }
+               service.removeTimerService(containerId, id);
+            }
+            return null;
          }
-         service.removeTimerService(containerId, id);
-      }
+      });
    }
 
    // Private




More information about the jboss-cvs-commits mailing list