You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "ant elder (JIRA)" <de...@tuscany.apache.org> on 2011/09/07 14:07:10 UTC

[jira] [Commented] (TUSCANY-3939) URLClassLoader locks the contrubution jar.

    [ https://issues.apache.org/jira/browse/TUSCANY-3939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13098870#comment-13098870 ] 

ant elder commented on TUSCANY-3939:
------------------------------------

I've added some code that uses the ClassLoaderUtil.releaseLoader method to free the contribution jar when a contribution is unloaded. This happens in the ContributionListener which will only work if the domain registry impl supports the ContributionListener function, does that work in your environment? If not then we could look at adding it to somewhere to the stop processing path but this current place looks simpler if it does work ok.

> URLClassLoader locks the contrubution jar.
> ------------------------------------------
>
>                 Key: TUSCANY-3939
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3939
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Assembly Model
>    Affects Versions: Java-SCA-2.0-Beta1
>         Environment: All
>            Reporter: Hasan Muhammad
>            Assignee: ant elder
>            Priority: Critical
>             Fix For: Java-SCA-2.0
>
>
> When a contribution is started, tuscany 2.0 uses URLClassLoader to load the classes/resources from the contribution. It locks the jar file and does not release the lock even on contribution stop. This is not a bug in tuscany code. This is a problem with Sun's URLClassLoader. Sun has a fix for this that is planned for Java 1.7. But for now, during contribution stop, the following method could be used without any issues, to release the classloader and all the resources it holds
> ClassLoaderUtil.releaseLoader((URLClassLoader)context.getApplicationClassLoader().getParent());
> Note that this method needs to be called on all Unused Contributions in the node, so that those contributions are also unlocked. The list of unused contributions already exists in the node since we have the following method
> node.stopCompositeAndUninstallUnused

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira