[jboss-cvs] JBossAS SVN: r88602 - projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon May 11 03:52:01 EDT 2009
Author: ALRubinger
Date: 2009-05-11 03:52:01 -0400 (Mon, 11 May 2009)
New Revision: 88602
Modified:
projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/AbstractServer.java
projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/SecurityActions.java
Log:
[JBBOOT-69] Port the TCCL Bootstrap.start hack
Modified: projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/AbstractServer.java
===================================================================
--- projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/AbstractServer.java 2009-05-11 07:48:23 UTC (rev 88601)
+++ projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/AbstractServer.java 2009-05-11 07:52:01 UTC (rev 88602)
@@ -683,8 +683,29 @@
// Add in reverse order
this.getStartedBootstraps().add(0, bootstrap);
- // Start
- bootstrap.start(typedServer);
+ // Remember TCCL
+ @Deprecated
+ final ClassLoader oldCl = SecurityActions.getThreadContextClassLoader();
+
+ // Get new TCCL
+ @Deprecated
+ final ClassLoader bootstrapCl = bootstrap.getClass().getClassLoader();
+
+ try
+ {
+ // Set the bootstrap CL
+ // FIXME This is a carryover hack from the legacy implementation,
+ // still required for proper visibility
+ SecurityActions.setThreadContextClassLoader(bootstrapCl);
+
+ // Start
+ bootstrap.start(typedServer);
+ }
+ finally
+ {
+ // Reset the TCCL
+ SecurityActions.setThreadContextClassLoader(oldCl);
+ }
}
}
Modified: projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/SecurityActions.java
===================================================================
--- projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/SecurityActions.java 2009-05-11 07:48:23 UTC (rev 88601)
+++ projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/SecurityActions.java 2009-05-11 07:52:01 UTC (rev 88602)
@@ -178,6 +178,43 @@
return returnValue;
}
+ /**
+ * Obtains the Thread Context ClassLoader
+ */
+ static ClassLoader getThreadContextClassLoader()
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+
+ /**
+ * Sets the specified CL upon the current Thread's Context
+ *
+ * @param cl
+ * @throws IllegalArgumentException If the CL was null
+ */
+ static void setThreadContextClassLoader(final ClassLoader cl) throws IllegalArgumentException
+ {
+ if (cl == null)
+ {
+ throw new IllegalArgumentException("ClassLoader was null");
+ }
+
+ AccessController.doPrivileged(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ Thread.currentThread().setContextClassLoader(cl);
+ return null;
+ };
+ });
+ }
+
//-------------------------------------------------------------------------------------||
// Internal Helper Methods ------------------------------------------------------------||
//-------------------------------------------------------------------------------------||
More information about the jboss-cvs-commits
mailing list