jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r554955 - /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java
Date Tue, 10 Jul 2007 14:15:55 GMT
Author: mreutegg
Date: Tue Jul 10 07:15:54 2007
New Revision: 554955

URL: http://svn.apache.org/viewvc?view=rev&rev=554955
Log:
- Only register as internal event listener when external listeners are added.

Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java?view=diff&rev=554955&r1=554954&r2=554955
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java
Tue Jul 10 07:15:54 2007
@@ -78,6 +78,12 @@
     private Map readOnlySubscriptions;
 
     /**
+     * Indicates if this observation manager is registered as an internal event
+     * listener on the workspace manager.
+     */
+    private boolean isRegistered = false;
+
+    /**
      * Creates a new observation manager for <code>session</code>.
      * @param wspManager the WorkspaceManager.
      * @param nsResolver NamespaceResolver to be used by this observation manager
@@ -88,7 +94,6 @@
         this.wspManager = wspManager;
         this.nsResolver = nsResolver;
         this.ntRegistry = ntRegistry;
-        this.wspManager.addEventListener(this);
     }
 
     /**
@@ -101,6 +106,10 @@
                                  String[] uuids,
                                  String[] nodeTypeNames,
                                  boolean noLocal) throws RepositoryException {
+        if (!isRegistered) {
+            wspManager.addEventListener(this);
+            isRegistered = true;
+        }
         Path path;
         try {
             path = PathFormat.parse(absPath, nsResolver).getCanonicalPath();



Mime
View raw message