[
https://issues.apache.org/jira/browse/APEXCORE-767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16100816#comment-16100816
]
Florian Schmidt edited comment on APEXCORE-767 at 7/25/17 9:30 PM:
-------------------------------------------------------------------
A possible design to ensure the proper "unloading" of the dependencies could be
the following:
# Add a field {{initialClassLoader}} to the {{StramAppLauncher}}, which gets
initialized in the constructor of {{StramAppLauncher}}
# Add a method {{resetContextClassLoader()}} to the {{StramAppLauncher}}, that
allows us to reset the contextClassLoader to the initialClassLoader once the
loaded dependencies are not needed anymore (e.g. the application is launched or
completed)
# Ensure that calls to {{resetContextClassLoader()}} are made in all those
places where dependencies were loaded before with {{loadDependencies}} when the
application is launched or completed
# Implement {{initialClassLoader}} and {{resetContextClassLoader}} in a way
that they can only be called on the same thread that the instance of
{{StramAppLauncher}} was constructed on, making sure that the calls to
{{Thread.currentThread().setContextClassLoader(...)}} in {{loadDependencies()}}
and {{resetContextClassLoader()}} are never called from another thread
was (Author: florianschmidt):
A possible design to ensure the proper "unloading" of the dependencies could be
the following:
# Add a field {{initialClassLoader}} to the {{StramAppLauncher}}, which gets
initialized in the constructor of {{StramAppLauncher}}
# Add a method {{resetContextClassLoader()}} to the {{StramAppLauncher}}, that
allows us to reset the contextClassLoader to the initialClassLoader once the
loaded dependencies are not needed anymore (e.g. the application is launched or
completed)
# Ensure that calls to {{resetContextClassLoader()}} are made in all those
places where dependencies were loaded before with {{loadDependencies}} when
those dependencies are not needed anymore.
# Implement {{initialClassLoader}} and {{resetContextClassLoader}} in a way
that they can only be called on the same thread that the instance of
{{StramAppLauncher}} was constructed on, making sure that the calls to
{{Thread.currentThread().setContextClassLoader(...)}} in {{loadDependencies()}}
and {{resetContextClassLoader()}} are never called from another thread
> Duplicate class loading in CLI for single application launch
> -------------------------------------------------------------
>
> Key: APEXCORE-767
> URL: https://issues.apache.org/jira/browse/APEXCORE-767
> Project: Apache Apex Core
> Issue Type: Bug
> Reporter: Thomas Weise
> Assignee: Florian Schmidt
>
> StramAppLauncher will create multiple class loaders in a way that leads to
> duplicate loading of the same class (while listing app package, then when
> launching). It also appears that the context class loader is never reset.
>
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)