Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
ba5e6b24
Commit
ba5e6b24
authored
5 years ago
by
rmani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3092:Atlas Plugin ClassLoader Doesn't Restore Thread ClassLoader
parent
727e6e03
master
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
AtlasPluginClassLoader.java
...ache/atlas/plugin/classloader/AtlasPluginClassLoader.java
+15
-2
No files found.
plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoader.java
View file @
ba5e6b24
...
...
@@ -39,6 +39,8 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
private
static
volatile
AtlasPluginClassLoader
me
=
null
;
private
final
ThreadLocal
<
ClassLoader
>
preActivateClassLoader
=
new
ThreadLocal
<>();
private
final
MyClassLoader
componentClassLoader
;
private
AtlasPluginClassLoader
(
String
pluginType
,
Class
<?>
pluginClass
)
throws
URISyntaxException
{
...
...
@@ -207,6 +209,8 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
LOG
.
debug
(
"==> AtlasPluginClassLoader.activate()"
);
}
preActivateClassLoader
.
set
(
Thread
.
currentThread
().
getContextClassLoader
());
Thread
.
currentThread
().
setContextClassLoader
(
this
);
if
(
LOG
.
isDebugEnabled
())
{
...
...
@@ -219,10 +223,19 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
LOG
.
debug
(
"==> AtlasPluginClassLoader.deactivate()"
);
}
MyClassLoader
savedClassLoader
=
getComponentClassLoader
();
ClassLoader
classLoader
=
preActivateClassLoader
.
get
();
if
(
classLoader
!=
null
)
{
preActivateClassLoader
.
remove
();
}
else
{
MyClassLoader
savedClassLoader
=
getComponentClassLoader
();
if
(
savedClassLoader
!=
null
&&
savedClassLoader
.
getParent
()
!=
null
)
{
Thread
.
currentThread
().
setContextClassLoader
(
savedClassLoader
.
getParent
());
classLoader
=
savedClassLoader
.
getParent
();
}
}
if
(
classLoader
!=
null
)
{
Thread
.
currentThread
().
setContextClassLoader
(
classLoader
);
}
else
{
LOG
.
warn
(
"AtlasPluginClassLoader.deactivate() was not successful.Couldn't not get the saved "
+
"componentClassLoader..."
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment