Author: anil.saldhana(a)jboss.com
Date: 2011-03-23 13:40:40 -0400 (Wed, 23 Mar 2011)
New Revision: 841
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/factories/SecurityActions.java
Log:
workaround AS6 issues with mbean server domains
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/factories/SecurityActions.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/factories/SecurityActions.java 2011-03-23
17:13:18 UTC (rev 840)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/factories/SecurityActions.java 2011-03-23
17:40:40 UTC (rev 841)
@@ -40,7 +40,7 @@
* @version $Revision: 1 $
*/
class SecurityActions
-{
+{
static SecurityContext createSecurityContext() throws PrivilegedActionException
{
return AccessController.doPrivileged(new
PrivilegedExceptionAction<SecurityContext>()
@@ -51,24 +51,33 @@
}
});
}
-
+
static MBeanServer getJBossMBeanServer()
{
- return AccessController.doPrivileged( new PrivilegedAction<MBeanServer>()
- {
+ return AccessController.doPrivileged(new PrivilegedAction<MBeanServer>()
+ {
public MBeanServer run()
- {
- for (Iterator<MBeanServer> i =
MBeanServerFactory.findMBeanServer(null).iterator(); i.hasNext(); )
+ {
+ //Differences in JBAS5.1, 6.0 with the "jboss" mbean server.
+ MBeanServer cached = null;
+
+ for (Iterator<MBeanServer> i =
MBeanServerFactory.findMBeanServer(null).iterator(); i.hasNext();)
{
MBeanServer server = i.next();
+
+ if (server.getDefaultDomain().contains("Default"))
+ cached = server;
+
if (server.getDefaultDomain().equals("jboss"))
{
return server;
}
}
+ if (cached != null)
+ return cached; //We did not find one with jboss but there is
"DefaultDomain" which is the norm in AS6
throw new IllegalStateException("No 'jboss' MBeanServer
found!");
}
});
-
+
}
}
\ No newline at end of file
Show replies by date