]
Howard Gao commented on JBMESSAGING-1756:
-----------------------------------------
The setTCL() and getTCL() seems not necessary. I'll remove them from the code and see
if it breaks anything.
OrderedExecutorFactory$ChildExecutor doesn't properly set the
context class loader
----------------------------------------------------------------------------------
Key: JBMESSAGING-1756
URL:
https://jira.jboss.org/jira/browse/JBMESSAGING-1756
Project: JBoss Messaging
Issue Type: Bug
Components: JMS Facade
Affects Versions: 1.4.0.SP3.CP09, 1.4.5.GA, 1.4.6.GA
Reporter: Howard Gao
Assignee: Howard Gao
Fix For: 1.4.0.SP3.CP10, 1.4.6.GA.SP1, 1.4.7.GA
Whenever a new ChildExecutor is created by OrderedExecutorFactory, it holds the reference
of the classloader of the current calling thread immediately inside the execute() call,
like:
public void execute(Runnable command)
{
if (needToSetClassLoader)
{
tcl = SecurityActions.getTCL();
}
synchronized (tasks)
{
if (!shutdown)
{
tasks.add(command);
if (tasks.size() == 1 && runningChildren.add(this))
{
parent.execute(this);
}
}
}
}
The initial value for 'needToSetClassLoader' is true. It is changed to
'false' when the tasks is being executed in run() method:
public void run()
{
if (needToSetClassLoader)
{
needToSetClassLoader = false;
SecurityActions.setTCL(SecurityActions.getTCL());
}
//executing tasks
}
So in this way, the context classloaders for all the threads are set to be the one from
the creating thread. It will cause problems when the creating thread's class loader is
no longer valid and the threads are still referencing it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: