[Mc4j-cvs] SF.net SVN: mc4j:[597] trunk/mc4j/modules/ems
                
                Brought to you by:
                
                    ghinkl
                    
                
            
            
        
        
        
    | 
      
      
      From: <ian...@us...> - 2009-06-15 20:14:34
      
     | 
| Revision: 597
          http://mc4j.svn.sourceforge.net/mc4j/?rev=597&view=rev
Author:   ianpspringer
Date:     2009-06-15 19:52:30 +0000 (Mon, 15 Jun 2009)
Log Message:
-----------
fix OOME caused by original fix for https://jira.jboss.org/jira/browse/JOPR-9
Modified Paths:
--------------
    trunk/mc4j/modules/ems/build.xml
    trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/support/providers/JBossConnectionProvider.java
    trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/support/providers/proxy/GenericMBeanServerProxy.java
Property Changed:
----------------
    trunk/mc4j/modules/ems/
Property changes on: trunk/mc4j/modules/ems
___________________________________________________________________
Added: svn:ignore
   + build
classes
dist
javadocs
Modified: trunk/mc4j/modules/ems/build.xml
===================================================================
--- trunk/mc4j/modules/ems/build.xml	2009-05-26 19:46:13 UTC (rev 596)
+++ trunk/mc4j/modules/ems/build.xml	2009-06-15 19:52:30 UTC (rev 597)
@@ -6,7 +6,7 @@
  Author: Greg Hinkle
 
 
- Copyright 2002-2005 Greg Hinkle
+ Copyright 2002-2009 Greg Hinkle
 
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
 
     <property name="module.jar" value="org-mc4j-ems.jar"/>
 
-    <property name="release.version" value="1.2.6"/>
+    <property name="release.version" value="1.2.7"/>
 
 
     <target
Modified: trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/support/providers/JBossConnectionProvider.java
===================================================================
--- trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/support/providers/JBossConnectionProvider.java	2009-05-26 19:46:13 UTC (rev 596)
+++ trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/support/providers/JBossConnectionProvider.java	2009-06-15 19:52:30 UTC (rev 597)
@@ -28,6 +28,7 @@
 import javax.naming.NoInitialContextException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.lang.reflect.Constructor;
 import java.security.AccessController;
 import java.security.Principal;
 import java.security.PrivilegedAction;
@@ -237,9 +238,16 @@
     }
 
     public void resetPrincipalInfo() throws Exception {
+        // We need to tell the SecurityAssociation class to clear its internal ThreadLocal stack of authenticated
+        // subjects. Otherwise, every time we set the princiapl info, this stack will grow and will eventually cause the
+        // heap to max out. For more on this issue, see https://jira.jboss.org/jira/browse/EJBTHREE-558.
+        Class securityAssociationClass = Class.forName("org.jboss.security.SecurityAssociation");
+        Method clearMethod = securityAssociationClass.getMethod("clear");
+        clearMethod.invoke(null);        
+
         Class simplePrincipalClass = Class.forName("org.jboss.security.SimplePrincipal");
-        Principal principal = (Principal) simplePrincipalClass.getConstructor(String.class).newInstance(
-            getConnectionSettings().getPrincipal());
+        Constructor simplePrincipalConstructor = simplePrincipalClass.getConstructor(String.class);
+        Principal principal = (Principal) simplePrincipalConstructor.newInstance(getConnectionSettings().getPrincipal());
         SetPrincipalInfoAction.setPrincipalInfo(principal, getConnectionSettings().getCredentials());
     }
 }
Modified: trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/support/providers/proxy/GenericMBeanServerProxy.java
===================================================================
--- trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/support/providers/proxy/GenericMBeanServerProxy.java	2009-05-26 19:46:13 UTC (rev 596)
+++ trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/support/providers/proxy/GenericMBeanServerProxy.java	2009-06-15 19:52:30 UTC (rev 597)
@@ -117,6 +117,8 @@
 //            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
             if (this.provider instanceof JBossConnectionProvider) {                   
                 JBossConnectionProvider jbossProvider = (JBossConnectionProvider) this.provider;
+                // See https://jira.jboss.org/jira/browse/JOPR-9 for an explanation of why we have to re-set the
+                // PrincipalInfo prior to every JBoss JMX call.                 
                 jbossProvider.resetPrincipalInfo();
             }
             return method.invoke(this.remoteServer, args);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |