Add discard quietly for node session
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 21 Apr 2011 11:24:17 +0000 (11:24 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 21 Apr 2011 11:24:17 +0000 (11:24 +0000)
ASSIGNED - bug 17: Generalize agent management and registration beyond JMS
https://bugzilla.argeo.org/show_bug.cgi?id=17

git-svn-id: https://svn.argeo.org/commons/trunk@4468 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java

index ebcb4ee9f5efd7da10c800bf077bbc320a0fbb61..f530f170b7fe4a0637d2eb72b75b4470dba07199 100644 (file)
@@ -652,6 +652,21 @@ public class JcrUtils implements ArgeoJcrConstants {
                }
        }
 
+       /**
+        * Discards the current changes in the session attached to this node. To be
+        * used typically in a catch block.
+        * 
+        * @see #discardQuietly(Session)
+        */
+       public static void discardUnderlyingSessionQuietly(Node node) {
+               try {
+                       discardQuietly(node.getSession());
+               } catch (RepositoryException e) {
+                       log.warn("Cannot quietly discard session of node " + node + ": "
+                                       + e.getMessage());
+               }
+       }
+
        /**
         * Discards the current changes in a session by calling
         * {@link Session#refresh(boolean)} with <code>false</code>, only logging