From: <one...@us...> - 2003-04-10 09:49:48
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cache In directory sc8-pr-cvs1:/tmp/cvs-serv4460/hibernate/cache Modified Files: NonstrictReadWriteCache.java Log Message: improvements to: * USE_REFLECTION_OPTIMIZER * Nonstrict cache * javadoc fixed bug in collection filter cache Index: NonstrictReadWriteCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cache/NonstrictReadWriteCache.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NonstrictReadWriteCache.java 4 Apr 2003 13:51:59 -0000 1.1 --- NonstrictReadWriteCache.java 10 Apr 2003 09:49:15 -0000 1.2 *************** *** 7,10 **** --- 7,12 ---- public class NonstrictReadWriteCache implements CacheConcurrencyStrategy { + private static final long TIMEOUT = 10000; + private final Cache cache; *************** *** 25,29 **** public void lock(Object key) throws CacheException { ! //cache.put(key, null); } --- 27,32 ---- public void lock(Object key) throws CacheException { ! // in case the server crashes, we need the lock to timeout ! cache.put( key, new Long( TIMEOUT + Timestamper.next() / Timestamper.ONE_MS ) ); } *************** *** 54,57 **** --- 57,61 ---- public void release(Object key) throws CacheException { if ( log.isDebugEnabled() ) log.debug("Invalidating: " + key); + // remove the lock (any later transaction can recache) cache.put( key, new Long( Timestamper.next() / Timestamper.ONE_MS ) ); } |