private void release(PersistenceTransaction ptx, Collection objects, Map newRoots) { // change done so now we can release the objects objectManager.releaseAll(ptx, objects); // NOTE: important to have released all objects in the TXN before // calling this event as the listeners tries to lookup for the object and blocks for (Iterator i = newRoots.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Entry) i.next(); fireRootCreatedEvent((String) entry.getKey(), (ObjectID) entry.getValue()); } }
public void apply( ServerTransaction txn, Map objects, BackReferences includeIDs, ObjectInstanceMonitor instanceMonitor) { final ServerTransactionID stxnID = txn.getServerTransactionID(); final ChannelID channelID = txn.getChannelID(); final TransactionID txnID = txn.getTransactionID(); final List changes = txn.getChanges(); GlobalTransactionID gtxID = txn.getGlobalTransactionID(); boolean active = isActive(); for (Iterator i = changes.iterator(); i.hasNext(); ) { DNA orgDNA = (DNA) i.next(); long version = orgDNA.getVersion(); if (version == DNA.NULL_VERSION) { Assert.assertFalse(gtxID.isNull()); version = gtxID.toLong(); } DNA change = new VersionizedDNAWrapper(orgDNA, version, true); ManagedObject mo = (ManagedObject) objects.get(change.getObjectID()); mo.apply(change, txnID, includeIDs, instanceMonitor, !active); if (active && !change.isDelta()) { // Only New objects reference are added here stateManager.addReference(txn.getChannelID(), mo.getID()); } } Map newRoots = txn.getNewRoots(); if (newRoots.size() > 0) { for (Iterator i = newRoots.entrySet().iterator(); i.hasNext(); ) { Entry entry = (Entry) i.next(); String rootName = (String) entry.getKey(); ObjectID newID = (ObjectID) entry.getValue(); objectManager.createRoot(rootName, newID); } } if (active) { channelStats.notifyTransaction(channelID); } transactionRateCounter.increment(); fireTransactionAppliedEvent(stxnID); }