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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to