You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:54:45 UTC
[sling-org-apache-sling-models-impl] 03/10: SLING-3313 - actually
use the seal() method to make the disposal callback list unmodifiable
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.models.impl-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git
commit d407d6f69cc24d60d4ac0a94396aa13c8ca20b99
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Fri Jan 31 04:06:42 2014 +0000
SLING-3313 - actually use the seal() method to make the disposal callback list unmodifiable
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/impl@1563046 13f79535-47bb-0310-9956-ffa450edef68
---
.../java/org/apache/sling/models/impl/ModelAdapterFactory.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java b/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
index 39bce98..aeb0655 100644
--- a/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
+++ b/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java
@@ -60,8 +60,6 @@ import org.apache.sling.models.annotations.Source;
import org.apache.sling.models.spi.DisposalCallback;
import org.apache.sling.models.spi.DisposalCallbackRegistry;
import org.apache.sling.models.spi.Injector;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
@@ -79,7 +77,7 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable {
callbacks.add(callback);
}
- private void lock() {
+ private void seal() {
callbacks = Collections.unmodifiableList(callbacks);
}
@@ -113,7 +111,7 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable {
public void run() {
java.lang.ref.Reference<? extends Object> ref = queue.poll();
if (ref != null) {
- log.info("calling disposal for " + ref.toString());
+ log.debug("calling disposal for " + ref.toString());
DisposalCallbackRegistryImpl registry = disposalCallbacks.remove(ref);
registry.onDisposed();
}
@@ -223,6 +221,8 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable {
}
}
+ registry.seal();
+
Iterator<Method> it = injectableMethods.iterator();
while (it.hasNext()) {
Method method = it.next();
@@ -305,6 +305,8 @@ public class ModelAdapterFactory implements AdapterFactory, Runnable {
}
}
+ registry.seal();
+
Iterator<Field> it = injectableFields.iterator();
while (it.hasNext()) {
Field field = it.next();
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.