[jboss-jira] [JBoss JIRA] Closed: (JBMESSAGING-1756) OrderedExecutorFactory$ChildExecutor doesn't properly set the context class loader
Howard Gao (JIRA)
jira-events at lists.jboss.org
Mon Nov 9 02:33:06 EST 2009
[ https://jira.jboss.org/jira/browse/JBMESSAGING-1756?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Howard Gao closed JBMESSAGING-1756.
-----------------------------------
Resolution: Done
Manually tested.
No unit test possible as it belongs to the AS integration test.
We only guarantee it doesn't break any existing functionality.
> 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: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list