jsedding commented on code in PR #104:
URL: 
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/104#discussion_r1327220837


##########
src/main/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandler.java:
##########
@@ -77,15 +117,24 @@ public void close() {
     void maybeRegisterFactory(final String unavailableName, final String 
unavailableServicePid) {
         if (!factoryRegistrationWorker.isShutdown()) {
             LOG.debug("submitting maybeRegisterFactory");
-            factoryRegistrationWorker.submit(() -> {
-                final boolean preconditionsOk = 
factoryPreconditions.checkPreconditions(unavailableName, unavailableServicePid);
-                if ( preconditionsOk && this.factoryRegistration == null ) {
+            final boolean preconditionsOk;
+            final ResourceResolverFactoryActivator localActivator;
+            try {
+                configurationLock.lock();
+                preconditionsOk = 
factoryPreconditions.checkPreconditions(unavailableName, unavailableServicePid);
+                localActivator = this.activator;
+            } finally {
+                configurationLock.unlock();
+            }
+
+            factoryRegistrationWorker.execute(() -> {
+                if (preconditionsOk && this.factoryRegistration == null) {

Review Comment:
   Again, same as abov. I'll add the `registrationLock` here.



-- 
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-unsubscr...@sling.apache.org

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

Reply via email to