Mercurial > hg > blitz_condensed
view src/org/dancres/blitz/notify/TxnNotifys.java @ 28:4b2f23b6feca
Add a schema compatibility check to indexer that parallels storage.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 12 Jun 2010 10:11:15 +0100 |
parents | 3dc0c5604566 |
children |
line wrap: on
line source
package org.dancres.blitz.notify; import java.io.IOException; import java.util.HashMap; import java.util.ArrayList; import java.util.LinkedList; import java.util.Iterator; import java.util.logging.Level; import org.dancres.blitz.txn.TxnState; import org.dancres.blitz.oid.OID; /** Tracks notify registrations associated with specific transactions. This is done so that when we receive a transaction ended event we can cleanup any outstanding templates associated with that transaction. @deprecated Transactional de-reg is handled by the generator when receiving end of transaction message. */ class TxnNotifys { private HashMap theRegsByTxn = new HashMap(); synchronized void track(OID aOID, TxnState aTxn) { // System.out.println("Tracking: " + aOID + ", " + aTxn.getId()); LinkedList myRegs = getRegs(aTxn); if (myRegs == null) { myRegs = new LinkedList(); theRegsByTxn.put(aTxn.getId(), myRegs); } myRegs.add(aOID); } /** Return an Iterator of OID's */ void unRegAll(TxnState aTxn) { Iterator myEventGenOIDs = null; synchronized(this) { LinkedList myRegs = (LinkedList) theRegsByTxn.remove(aTxn.getId()); if (myRegs != null) myEventGenOIDs = myRegs.iterator(); } if (myEventGenOIDs != null) { while (myEventGenOIDs.hasNext()) { OID myOID = (OID) myEventGenOIDs.next(); try { EventGeneratorFactory.get().cancel(myOID); } catch (IOException aDbe) { } } } } private LinkedList getRegs(TxnState aTxn) { return (LinkedList) theRegsByTxn.get(aTxn.getId()); } }