jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r156640 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: WorkspaceImpl.java observation/ObservationManagerImpl.java
Date Wed, 09 Mar 2005 12:54:51 GMT
Author: mreutegg
Date: Wed Mar  9 04:54:50 2005
New Revision: 156640

URL: http://svn.apache.org/viewcvs?view=rev&rev=156640
Log:
- JCR-57: WorkspaceImpl.dispose() might cause ClassNotFoundException
changed code as suggested by Felix Meschberger. see also comments in jira.

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java?view=diff&r1=156639&r2=156640
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java Wed
Mar  9 04:54:50 2005
@@ -59,8 +59,6 @@
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NodeTypeManager;
-import javax.jcr.observation.EventListener;
-import javax.jcr.observation.EventListenerIterator;
 import javax.jcr.observation.ObservationManager;
 import javax.jcr.query.QueryManager;
 import javax.jcr.version.Version;
@@ -161,16 +159,9 @@
      * Disposes this <code>WorkspaceImpl</code> and frees resources.
      */
     void dispose() {
-        try {
-            ObservationManager om = getObservationManager();
-            EventListenerIterator it = om.getRegisteredEventListeners();
-            while (it.hasNext()) {
-                EventListener l = it.nextEventListener();
-                log.debug("removing EventListener: " + l);
-                om.removeEventListener(l);
-            }
-        } catch (RepositoryException e) {
-            log.error("Exception while disposing Workspace:", e);
+        if (obsMgr != null) {
+            obsMgr.dispose();
+            obsMgr = null;
         }
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java?view=diff&r1=156639&r2=156640
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
Wed Mar  9 04:54:50 2005
@@ -157,4 +157,21 @@
         return new EventStateCollection(obsMgrFactory, session);
     }
 
+    /**
+     * Unregisters all EventListeners.
+     */
+    public void dispose() {
+        try {
+            EventListenerIterator it = getRegisteredEventListeners();
+            while (it.hasNext()) {
+                EventListener l = it.nextEventListener();
+                log.debug("removing EventListener: " + l);
+                removeEventListener(l);
+            }
+        } catch (RepositoryException e) {
+            log.error("Internal error: Unable to dispose ObservationManager.", e);
+        }
+
+    }
+
 }



Mime
View raw message