-
-
Notifications
You must be signed in to change notification settings - Fork 545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#394, keep dependent when unload plugin #416
Conversation
@@ -275,7 +275,7 @@ protected boolean unloadPlugin(String pluginId, boolean unloadDependents) { | |||
if (unloadDependents) { | |||
List<String> dependents = dependencyResolver.getDependents(pluginId); | |||
while (!dependents.isEmpty()) { | |||
String dependent = dependents.remove(0); | |||
String dependent = dependents.get(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the change because is very light.
Did you tested? I ask you because at first glance, this change produces an infinite loop (dependents
will never be empty and the while block will be executed forever).
ops...I didn't notice that and left it to unit test (all passed...) leave it for a while, I will rewrite it and add some unit test to cover the case. |
@decebals updated. also add unit test: PluginDependencyTest.dependentStop |
@@ -274,8 +274,7 @@ protected boolean unloadPlugin(String pluginId, boolean unloadDependents) { | |||
try { | |||
if (unloadDependents) { | |||
List<String> dependents = dependencyResolver.getDependents(pluginId); | |||
while (!dependents.isEmpty()) { | |||
String dependent = dependents.remove(0); | |||
for (String dependent : dependents) { | |||
unloadPlugin(dependent, false); | |||
dependents.addAll(0, dependencyResolver.getDependents(dependent)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this line will produce in the end a java.util.ConcurrentModificationException
.
I see something related to this issue. It's about #250. |
fix #394. Not sure will this change break other place.