[jboss-cvs] JBossAS SVN: r111209 - in branches/JBPAPP_5_1: server/src/main/org/jboss/ejb/plugins and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 19 09:50:01 EDT 2011


Author: jaikiran
Date: 2011-04-19 09:50:00 -0400 (Tue, 19 Apr 2011)
New Revision: 111209

Modified:
   branches/JBPAPP_5_1/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java
   branches/JBPAPP_5_1/server/src/main/org/jboss/ejb/plugins/RunAsSecurityInterceptor.java
   branches/JBPAPP_5_1/server/src/main/org/jboss/ejb/plugins/security/PreSecurityInterceptor.java
Log:
JBPAPP-6363 (Performance) Fix unguarded log.trace statements in various security interceptors

Modified: branches/JBPAPP_5_1/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java
===================================================================
--- branches/JBPAPP_5_1/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java	2011-04-19 13:12:26 UTC (rev 111208)
+++ branches/JBPAPP_5_1/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java	2011-04-19 13:50:00 UTC (rev 111209)
@@ -117,6 +117,9 @@
 
       // Set the SecurityManagement on the context
       SecurityActions.setSecurityManagement(newSC, securityManagement);
-      log.trace("establishSecurityIdentity:SecCtx="+SecurityActions.trace(newSC));
+      if (log.isTraceEnabled())
+      {
+         log.trace("establishSecurityIdentity:SecCtx="+SecurityActions.trace(newSC));
+      }
    }
 }

Modified: branches/JBPAPP_5_1/server/src/main/org/jboss/ejb/plugins/RunAsSecurityInterceptor.java
===================================================================
--- branches/JBPAPP_5_1/server/src/main/org/jboss/ejb/plugins/RunAsSecurityInterceptor.java	2011-04-19 13:12:26 UTC (rev 111208)
+++ branches/JBPAPP_5_1/server/src/main/org/jboss/ejb/plugins/RunAsSecurityInterceptor.java	2011-04-19 13:50:00 UTC (rev 111209)
@@ -110,8 +110,11 @@
       {
          securityDomain = securityManager.getSecurityDomain();
       }
-      log.trace("Bean:"+ container.getServiceName() + " securityDomain="+securityDomain 
+      if (log.isTraceEnabled())
+      {
+         log.trace("Bean:"+ container.getServiceName() + " securityDomain="+securityDomain
             + " isInvokeMethod="+ isInvokeMethod);
+      }
       //Establish a security context if one is missing for Run-As push
       if(SecurityActions.getSecurityContext() == null)
       {
@@ -126,7 +129,10 @@
       SecurityActions.pushRunAsIdentity(runAsIdentity);  
       SecurityActions.pushCallerRunAsIdentity(runAsIdentity);  
 
-      log.trace("Security Context = " + SecurityActions.trace(SecurityActions.getSecurityContext()));
+      if (log.isTraceEnabled())
+      {
+         log.trace("Security Context = " + SecurityActions.trace(SecurityActions.getSecurityContext()));
+      }
       try
       {
          if(isInvokeMethod)

Modified: branches/JBPAPP_5_1/server/src/main/org/jboss/ejb/plugins/security/PreSecurityInterceptor.java
===================================================================
--- branches/JBPAPP_5_1/server/src/main/org/jboss/ejb/plugins/security/PreSecurityInterceptor.java	2011-04-19 13:12:26 UTC (rev 111208)
+++ branches/JBPAPP_5_1/server/src/main/org/jboss/ejb/plugins/security/PreSecurityInterceptor.java	2011-04-19 13:50:00 UTC (rev 111209)
@@ -70,7 +70,10 @@
       }
       catch (Exception e)
       {
-         log.trace("Exception in creating TimedObject method:",e);
+         if (log.isTraceEnabled())
+         {
+            log.trace("Exception in creating TimedObject method:",e);
+         }
       } 
    }
 
@@ -98,8 +101,11 @@
          else
             return getNext().invokeHome(mi);
       }   
-      
-      log.trace("process:isInvoke="+isInvoke + " bean="+ container.getServiceName());
+
+      if (log.isTraceEnabled())
+      {
+         log.trace("process:isInvoke="+isInvoke + " bean="+ container.getServiceName());
+      }
       SecurityIdentity si = null;
       String incomingDomain = null;
       Method m = mi.getMethod();
@@ -107,7 +113,10 @@
       //For local ejb invocations
       if(mi.isLocal() && !isEjbTimeOutMethod)
       {
-         log.trace("True mi.isLocal() && !isEjbTimeOutMethod");
+         if (log.isTraceEnabled())
+         {
+            log.trace("True mi.isLocal() && !isEjbTimeOutMethod");
+         }
          //Cache the security context
          SecurityContext sc = SecurityActions.getSecurityContext();
          if(sc != null)
@@ -119,14 +128,20 @@
          SecurityActions.setSecurityManagement(sc, container.getSecurityManagement());
          // set the container's security domain in the security context
          SecurityActions.setSecurityDomain(sc, this.securityDomain);
-         
-         log.trace("SecurityIdentity="+SecurityActions.trace(si));
+
+         if (log.isTraceEnabled())
+         {
+            log.trace("SecurityIdentity="+SecurityActions.trace(si));
+         }
          //Set the security context on the invocation
          mi.setSecurityContext(sc); 
       }
       else
       {
-         log.trace("False mi.isLocal() && !isEjbTimeOutMethod");
+         if (log.isTraceEnabled())
+         {
+            log.trace("False mi.isLocal() && !isEjbTimeOutMethod");
+         }
          establishSecurityContext(mi); 
       } 
       
@@ -135,7 +150,10 @@
          //Establish the run-as on the SC as the caller SC
          SecurityContext currentSC = SecurityActions.getSecurityContext();
          SecurityActions.pushCallerRunAsIdentity(currentSC.getOutgoingRunAs());
-         log.trace("Going to the SecurityInterceptor with SC="+SecurityActions.trace(currentSC));
+         if (log.isTraceEnabled())
+         {
+            log.trace("Going to the SecurityInterceptor with SC="+SecurityActions.trace(currentSC));
+         }
          if(isInvoke)
             return getNext().invoke(mi);
          else
@@ -148,7 +166,10 @@
             SecurityActions.setSecurityIdentity(SecurityActions.getSecurityContext(), si);
          if(mi.isLocal() && incomingDomain != null)
         	 SecurityActions.setSecurityDomain(SecurityActions.getSecurityContext(), incomingDomain);
-         log.trace("Exit process():isInvoke="+isInvoke);
+         if (log.isTraceEnabled())
+         {
+            log.trace("Exit process():isInvoke="+isInvoke);
+         }
       } 
    }
    
@@ -173,6 +194,9 @@
       }
       //Set the SecurityManagement on the context
       SecurityActions.setSecurityManagement(newSC, container.getSecurityManagement());
-      log.trace("establishSecurityIdentity:SecCtx="+SecurityActions.trace(newSC));
+      if (log.isTraceEnabled())
+      {
+         log.trace("establishSecurityIdentity:SecCtx="+SecurityActions.trace(newSC));
+      }
    }
 }



More information about the jboss-cvs-commits mailing list