You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2020/04/26 07:49:20 UTC
[sling-org-apache-sling-engine] branch master updated: SLING-9398 :
Context might get unregistered on modification
This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git
The following commit(s) were added to refs/heads/master by this push:
new b9c4742 SLING-9398 : Context might get unregistered on modification
b9c4742 is described below
commit b9c474230981679a324355fed4a0165d7faf2ad2
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun Apr 26 09:49:08 2020 +0200
SLING-9398 : Context might get unregistered on modification
---
.../org/apache/sling/engine/impl/SlingMainServlet.java | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java b/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java
index 7451c76..d1e3add 100644
--- a/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java
+++ b/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java
@@ -24,7 +24,6 @@ import java.util.Hashtable;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
import javax.management.NotCompliantMBeanException;
import javax.servlet.GenericServlet;
@@ -209,8 +208,6 @@ public class SlingMainServlet extends GenericServlet {
private final CountDownLatch asyncActivation = new CountDownLatch(1);
- private final AtomicBoolean isModification = new AtomicBoolean();
-
// ---------- Servlet API -------------------------------------------------
@Override
@@ -381,8 +378,6 @@ public class SlingMainServlet extends GenericServlet {
@Modified
protected void modified(final Config config) {
- this.isModification.set(true);
-
setup(config);
}
@@ -464,7 +459,6 @@ public class SlingMainServlet extends GenericServlet {
protected void activate(final BundleContext bundleContext, final Config config) {
this.bundleContext = bundleContext;
- this.isModification.set(false);
this.setup(config);
}
@@ -477,13 +471,6 @@ public class SlingMainServlet extends GenericServlet {
}
}
- @Override
- public void destroy() {
- if (!this.isModification.compareAndSet(true, false)) {
- unregisterSlingServletContext();
- }
- }
-
// registration needs to be async. if it is done synchronously
// there is potential for a deadlock involving Felix global lock
// and a lock held by HTTP Whiteboard while calling Servlet#init()
@@ -537,6 +524,9 @@ public class SlingMainServlet extends GenericServlet {
"being called. There is a risk that objects are not properly destroyed.");
}
+ // first unregister servlet context
+ unregisterSlingServletContext();
+
// second unregister the servlet context *before* unregistering
// and destroying the the sling main servlet
if (this.contextRegistration != null) {