01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.l2.handler;
06:
07: import com.tc.async.api.AbstractEventHandler;
08: import com.tc.async.api.ConfigurationContext;
09: import com.tc.async.api.EventContext;
10: import com.tc.l2.msg.ServerTxnAckMessage;
11: import com.tc.net.groups.NodeID;
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 waitee = msg.messageFrom();
27: for (Iterator i = ackedTxns.iterator(); i.hasNext();) {
28: ServerTransactionID sid = (ServerTransactionID) i.next();
29: transactionManager.acknowledgement(sid.getSourceID(), sid
30: .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: }
|