[hibernate-commits] Hibernate SVN: r14107 - core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/util.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Oct 18 23:14:08 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-10-18 23:14:08 -0400 (Thu, 18 Oct 2007)
New Revision: 14107

Modified:
   core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/util/CacheHelper.java
Log:
Add helper method to remove a single node

Modified: core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/util/CacheHelper.java
===================================================================
--- core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/util/CacheHelper.java	2007-10-19 03:13:41 UTC (rev 14106)
+++ core/trunk/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/util/CacheHelper.java	2007-10-19 03:14:08 UTC (rev 14107)
@@ -372,6 +372,27 @@
             throw new CacheException(e);
         }
     }
+
+    /**
+     * Performs a JBoss Cache <code>removeNode(Fqn)</code>, wrapping any
+     * exception in a {@link CacheException}.
+     * 
+     * @param cache
+     *            the cache to invoke on
+     * @param region
+     *            base Fqn for the cache region
+     * @param option
+     *            invocation Option to set for this invocation. May be
+     *            <code>null</code>.
+     */
+    public static void removeNode(Cache cache, Fqn region, Object key, Option option) throws CacheException {
+        try {
+            setInvocationOption(cache, option);
+            cache.removeNode(new Fqn(region, key));
+        } catch (Exception e) {
+            throw new CacheException(e);
+        }
+    }
     
     public static Node addNode(Cache cache, Fqn fqn, boolean localOnly, boolean resident, DataVersion version)
             throws CacheException {




More information about the hibernate-commits mailing list