You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2018/12/06 20:53:59 UTC
[8/9] tomee git commit: TOMEE-2322 restore previous classloader at
the end
TOMEE-2322 restore previous classloader at the end
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/3bffc921
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/3bffc921
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/3bffc921
Branch: refs/heads/tomee-7.0.x
Commit: 3bffc921284874c13012a62a099feaab4a222a37
Parents: c56e301
Author: Jonathan Gallimore <jg...@tomitribe.com>
Authored: Thu Dec 6 15:09:10 2018 +0000
Committer: Jonathan Gallimore <jg...@tomitribe.com>
Committed: Thu Dec 6 20:43:48 2018 +0000
----------------------------------------------------------------------
.../src/main/java/org/apache/openejb/cli/Bootstrap.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/3bffc921/container/openejb-core/src/main/java/org/apache/openejb/cli/Bootstrap.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cli/Bootstrap.java b/container/openejb-core/src/main/java/org/apache/openejb/cli/Bootstrap.java
index b5508a3..95e879e 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/cli/Bootstrap.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/cli/Bootstrap.java
@@ -175,10 +175,12 @@ public class Bootstrap {
* Read commands from BASE_PATH (using XBean's ResourceFinder) and execute the one specified on the command line
*/
public static void main(final String[] args) throws Exception {
+ ClassLoader cl = null;
setupHome(args);
try (final URLClassLoader loader = setupClasspath()) {
if (loader != null) {
+ cl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(loader);
if (loader != ClassLoader.getSystemClassLoader()) {
System.setProperty("openejb.classloader.first.disallow-system-loading", "true");
@@ -200,6 +202,10 @@ public class Bootstrap {
throw Error.class.cast(cause);
}
throw new IllegalStateException(cause);
+ } finally {
+ if (cl != null) {
+ Thread.currentThread().setContextClassLoader(cl);
+ }
}
}
}