Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/cache
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19424/src/org/hibernate/cache
Modified Files:
OptimisticTreeCache.java TreeCache.java
Log Message:
HHH-1251 : non-replicated clearing of TreeCache on SessionFactory shutdown
Index: OptimisticTreeCache.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/cache/OptimisticTreeCache.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- OptimisticTreeCache.java 9 Feb 2006 20:48:42 -0000 1.1
+++ OptimisticTreeCache.java 21 Feb 2006 14:11:28 -0000 1.2
@@ -166,7 +166,14 @@
}
public void destroy() throws CacheException {
- clear();
+ try {
+ Option option = new Option();
+ option.setCacheModeLocal( true );
+ cache.remove( new Fqn( regionName ), option );
+ }
+ catch( Exception e ) {
+ throw new CacheException( e );
+ }
}
public void lock(Object key) throws CacheException {
Index: TreeCache.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/cache/TreeCache.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- TreeCache.java 10 Aug 2005 04:54:07 -0000 1.17
+++ TreeCache.java 21 Feb 2006 14:11:28 -0000 1.18
@@ -126,7 +126,17 @@
}
public void destroy() throws CacheException {
- clear();
+ try {
+ // NOTE : evict() operates locally only (i.e., does not propogate
+ // to any other nodes in the potential cluster). This is
+ // exactly what is needed when we destroy() here; destroy() is used
+ // as part of the process of shutting down a SessionFactory; thus
+ // these removals should not be propogated
+ cache.evict( new Fqn( regionName ) );
+ }
+ catch( Exception e ) {
+ throw new CacheException( e );
+ }
}
public void lock(Object key) throws CacheException {
|