Mercurial > hg > blitz_stable
diff src/org/dancres/blitz/TxnReapFilter.java @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/org/dancres/blitz/TxnReapFilter.java Sat Mar 21 11:00:06 2009 +0000 @@ -0,0 +1,31 @@ +package org.dancres.blitz; + +import org.dancres.blitz.lease.ReapFilter; +import org.dancres.blitz.lease.LeasedResource; + +import org.dancres.blitz.entry.EntrySleeve; + +import org.dancres.blitz.txnlock.*; + +/** + Blocks collection of EntrySleeve instances which are currently held under + some sort of transaction lock. + */ +public class TxnReapFilter implements ReapFilter { + public boolean filter(LeasedResource anObject) { + if (anObject instanceof EntrySleeve) { + EntrySleeve mySleeve = (EntrySleeve) anObject; + + LockMgr myMgr = + TxnLocks.getLockMgr(mySleeve.getEntry().getType()); + + // System.err.println("HasLock: " + + // myMgr.hasActiveLock(mySleeve.getOID())); + + return myMgr.hasActiveLock(mySleeve.getOID()); + } + + // We don't mind if this object is reaped - return "not filtered" + return false; + } +}