From 2e256eea0004998d101b2df989cae4f419b74032 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Thu, 21 Apr 2011 11:24:17 +0000 Subject: [PATCH] Add discard quietly for node session 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 --- .../src/main/java/org/argeo/jcr/JcrUtils.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java b/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java index ebcb4ee9f..f530f170b 100644 --- a/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java +++ b/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java @@ -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 false, only logging -- 2.30.2