1 4 package com.tc.objectserver.tx; 5 6 import com.tc.net.protocol.tcm.ChannelID; 7 import com.tc.object.msg.DSOMessageBase; 8 import com.tc.object.msg.MessageRecyclerImpl; 9 import com.tc.object.tx.ServerTransactionID; 10 11 import java.util.Collection ; 12 import java.util.HashSet ; 13 import java.util.Iterator ; 14 import java.util.Set ; 15 16 public class CommitTransactionMessageRecycler extends MessageRecyclerImpl implements ServerTransactionListener { 17 18 private final Set resentTransactionIDs = new HashSet (); 19 20 public CommitTransactionMessageRecycler(ServerTransactionManager transactionManager) { 21 super(); 22 transactionManager.addTransactionListener(this); 23 } 24 25 public synchronized void addMessage(DSOMessageBase message, Set keys) { 26 if (resentTransactionIDs.size() > 0) { 27 if (resentTransactionIDs.removeAll(keys)) { 28 if (false) System.err.println("MessageRecycler :: ignoring resent message : resentTxIDs.size() = " 30 + resentTransactionIDs.size()); 31 return; 32 } 33 } 34 super.addMessage(message, keys); 35 } 36 37 public void transactionCompleted(ServerTransactionID stxID) { 38 recycle(stxID); 39 } 40 41 public void addResentServerTransactionIDs(Collection stxIDs) { 42 resentTransactionIDs.addAll(stxIDs); 43 } 44 45 public void clearAllTransactionsFor(ChannelID client) { 46 for (Iterator iter = resentTransactionIDs.iterator(); iter.hasNext();) { 47 ServerTransactionID stxID = (ServerTransactionID) iter.next(); 48 if (stxID.getChannelID().equals(client)) { 49 iter.remove(); 50 } 51 } 52 } 53 54 public void transactionApplied(ServerTransactionID stxID) { 55 return; 56 } 57 58 public void incomingTransactions(ChannelID cid, Set serverTxnIDs) { 59 return; 60 } 61 62 } 63 | Popular Tags |