You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "jsedding (via GitHub)" <gi...@apache.org> on 2023/04/11 16:16:49 UTC

[GitHub] [sling-org-apache-sling-engine] jsedding commented on a diff in pull request #32: SLING-11824 : Deadlock during repository restart

jsedding commented on code in PR #32:
URL: https://github.com/apache/sling-org-apache-sling-engine/pull/32#discussion_r1163046176


##########
src/main/java/org/apache/sling/engine/impl/helper/SlingServletContext.java:
##########
@@ -199,37 +202,78 @@ private void setServerInfo() {
         }
     }
 
-    @Override
-    public void contextDestroyed(final ServletContextEvent sce) {
-        synchronized ( this ) {
-            this.servletContext = null;
-            this.setServerInfo();
-            if ( this.registration != null ) {
-                this.registration.unregister();
-                this.registration = null;    
-            }
+    private void runAsync(final Runnable r) {
+        final Thread thread = new Thread(r, "SlingServletContext registration");

Review Comment:
   I think having different thread names for register and unregister might be useful.



##########
src/main/java/org/apache/sling/engine/impl/helper/SlingServletContext.java:
##########
@@ -116,6 +116,9 @@ public class SlingServletContext implements ServletContext, ServletContextListen
 
     private volatile String configuredServerInfo;
 
+    // counter to synchronize the init and destroy methods
+    private volatile long initCounter;

Review Comment:
   nit: wouldn't an int suffice? IIUC we don't care about an overflow, we only care that it's different.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org