SLING-6310 - clear disposal queue on component deactivation
authorJustin Edelson <justin@apache.org>
Sat, 19 Nov 2016 22:33:02 +0000 (22:33 +0000)
committerJustin Edelson <justin@apache.org>
Sat, 19 Nov 2016 22:33:02 +0000 (22:33 +0000)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1770521 13f79535-47bb-0310-9956-ffa450edef68

src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java

index d8c26bb..b66ad61 100644 (file)
@@ -136,6 +136,10 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
 
     @Override
     public void run() {
+        clearDisposalCallbackRegistryQueue();
+    }
+
+    private void clearDisposalCallbackRegistryQueue() {
         java.lang.ref.Reference<?> ref = queue.poll();
         while (ref != null) {
             log.debug("calling disposal for {}.", ref.toString());
@@ -944,6 +948,7 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable, ModelFacto
 
     @Deactivate
     protected void deactivate() {
+        this.clearDisposalCallbackRegistryQueue();
         this.listener.unregisterAll();
         this.adapterImplementations.removeAll();
         if (jobRegistration != null) {