[dna-commits] DNA SVN: r123 - trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Wed May 7 18:01:29 EDT 2008


Author: rhauch
Date: 2008-05-07 18:01:29 -0400 (Wed, 07 May 2008)
New Revision: 123

Modified:
   trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/ObservationService.java
Log:
Added a check to the code that unregisters workspace listeners to first see if the session is live before attempting to close it.

Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/ObservationService.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/ObservationService.java	2008-05-07 20:43:55 UTC (rev 122)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/ObservationService.java	2008-05-07 22:01:29 UTC (rev 123)
@@ -216,7 +216,7 @@
             try {
                 listener.unregister();
             } catch (RepositoryException e) {
-                this.logger.error(RepositoryI18n.errorUnregisteringWorkspaceListenerWhileShuttingDownObservationService);
+                this.logger.error(e, RepositoryI18n.errorUnregisteringWorkspaceListenerWhileShuttingDownObservationService);
             }
         }
     }
@@ -586,8 +586,10 @@
         public synchronized WorkspaceListener unregister() throws UnsupportedRepositoryOperationException, RepositoryException {
             if (this.session == null) return this;
             try {
-                this.session.getWorkspace().getObservationManager().removeEventListener(this);
-                this.session.logout();
+                if (this.session.isLive()) {
+                    this.session.getWorkspace().getObservationManager().removeEventListener(this);
+                    this.session.logout();
+                }
             } finally {
                 this.session = null;
                 unregisterListener(this);




More information about the dna-commits mailing list