1 4 package com.tc.l2.handler; 5 6 import com.tc.async.api.AbstractEventHandler; 7 import com.tc.async.api.ConfigurationContext; 8 import com.tc.async.api.EventContext; 9 import com.tc.l2.msg.ServerTxnAckMessage; 10 import com.tc.net.groups.NodeID; 11 import com.tc.net.protocol.tcm.ChannelID; 12 import com.tc.object.tx.ServerTransactionID; 13 import com.tc.objectserver.core.api.ServerConfigurationContext; 14 import com.tc.objectserver.tx.ServerTransactionManager; 15 16 import java.util.Iterator ; 17 import java.util.Set ; 18 19 public class ServerTransactionAckHandler extends AbstractEventHandler { 20 21 private ServerTransactionManager transactionManager; 22 23 public void handleEvent(EventContext context) { 24 ServerTxnAckMessage msg = (ServerTxnAckMessage) context; 25 Set ackedTxns = msg.getAckedServerTxnIDs(); 26 NodeID nodeID = msg.messageFrom(); 27 ChannelID waitee = nodeID.toChannelID(); 28 for (Iterator i = ackedTxns.iterator(); i.hasNext();) { 29 ServerTransactionID sid = (ServerTransactionID) i.next(); 30 transactionManager.acknowledgement(sid.getChannelID(), sid.getClientTransactionID(), waitee); 31 } 32 } 33 34 public void initialize(ConfigurationContext context) { 35 super.initialize(context); 36 ServerConfigurationContext oscc = (ServerConfigurationContext) context; 37 this.transactionManager = oscc.getTransactionManager(); 38 } 39 40 } 41 | Popular Tags |