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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 29 16:53:30 EDT 2010


Author: pferraro
Date: 2010-07-29 16:53:29 -0400 (Thu, 29 Jul 2010)
New Revision: 107218

Modified:
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/SessionAttributeMarshallerImpl.java
Log:
Don't perform security manager check every invocation.

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/SessionAttributeMarshallerImpl.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/SessionAttributeMarshallerImpl.java	2010-07-29 20:05:49 UTC (rev 107217)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/SessionAttributeMarshallerImpl.java	2010-07-29 20:53:29 UTC (rev 107218)
@@ -37,6 +37,10 @@
  */
 public class SessionAttributeMarshallerImpl implements SessionAttributeMarshaller
 {
+   @SuppressWarnings("unchecked")
+   // Need to cast since ContextClassLoaderSwitcher.NewInstance does not generically implement PrivilegedAction<ContextClassLoaderSwitcher>
+   private final ContextClassLoaderSwitcher switcher = (ContextClassLoaderSwitcher) AccessController.doPrivileged(ContextClassLoaderSwitcher.INSTANTIATOR);
+   
    private final LocalDistributableSessionManager manager;
    private final ObjectStreamSource source;
    
@@ -74,16 +78,11 @@
 
       SimpleCachableMarshalledValue value = (SimpleCachableMarshalledValue) object;
       
-      // Need to cast since ContextClassLoaderSwitcher.NewInstance does not generically implement PrivilegedAction<ContextClassLoaderSwitcher>
-      @SuppressWarnings("unchecked")
-      ContextClassLoaderSwitcher switcher = (ContextClassLoaderSwitcher) AccessController.doPrivileged(ContextClassLoaderSwitcher.INSTANTIATOR);
-      ContextClassLoaderSwitcher.SwitchContext switchContext = switcher.getSwitchContext();
+      // Swap in/out the class loader for this web app. Needed only for unmarshalling.
+      ContextClassLoaderSwitcher.SwitchContext switchContext = this.switcher.getSwitchContext(this.manager.getApplicationClassLoader());
       
       try
       {
-         // Swap in/out the class loader for this web app. Needed only for unmarshalling.
-         switchContext.setClassLoader(this.manager.getApplicationClassLoader());
-         
          value.setObjectStreamSource(this.source);
          
          return value.get();



More information about the jboss-cvs-commits mailing list