[Jboss-cvs] JBossAS SVN: r55472 - projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 9 23:09:34 EDT 2006
Author: scott.stark at jboss.org
Date: 2006-08-09 23:09:32 -0400 (Wed, 09 Aug 2006)
New Revision: 55472
Modified:
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/LifecycleAction.java
Log:
JBMICROCONT-100, lifecycle dispatch should be done with the target class loader as the thread context class loader
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/LifecycleAction.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/LifecycleAction.java 2006-08-10 03:07:09 UTC (rev 55471)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/LifecycleAction.java 2006-08-10 03:09:32 UTC (rev 55472)
@@ -95,9 +95,9 @@
String method = getInstallMethod(context);
List<ParameterMetaData> parameters = getInstallParameters(context);
MethodJoinpoint joinpoint = null;
+ ClassLoader cl = Configurator.getClassLoader(metaData);
try
{
- ClassLoader cl = Configurator.getClassLoader(metaData);
joinpoint = configurator.getMethodJoinPoint(info, cl, method, parameters, false, true);
}
catch (JoinpointException ignored)
@@ -111,8 +111,21 @@
}
return;
}
+
+ // Dispatch the joinpoint using the target class loader
joinpoint.setTarget(target);
- dispatchJoinPoint(context, joinpoint);
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ if( cl != null )
+ Thread.currentThread().setContextClassLoader(cl);
+ dispatchJoinPoint(context, joinpoint);
+ }
+ finally
+ {
+ if( cl != null )
+ Thread.currentThread().setContextClassLoader(tcl);
+ }
}
public void uninstallAction(KernelControllerContext context)
@@ -129,11 +142,16 @@
String method = getUninstallMethod(context);
List<ParameterMetaData> parameters = getUninstallParameters(context);
MethodJoinpoint joinpoint = null;
+ ClassLoader cl = null;
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
try
{
- ClassLoader cl = Configurator.getClassLoader(metaData);
+ cl = Configurator.getClassLoader(metaData);
joinpoint = configurator.getMethodJoinPoint(info, cl, method, parameters, false, true);
joinpoint.setTarget(target);
+ // Dispatch the joinpoint using the target class loader
+ if( cl != null )
+ Thread.currentThread().setContextClassLoader(cl);
dispatchJoinPoint(context, joinpoint);
}
catch (JoinpointException ignored)
@@ -151,5 +169,10 @@
{
log.warn("Error during " + method, throwable);
}
+ finally
+ {
+ if( cl != null )
+ Thread.currentThread().setContextClassLoader(tcl);
+ }
}
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list