01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.object.msg;
05:
06: import com.tc.bytes.TCByteBuffer;
07: import com.tc.io.TCByteBufferOutput;
08: import com.tc.net.protocol.tcm.MessageChannel;
09: import com.tc.net.protocol.tcm.MessageMonitor;
10: import com.tc.net.protocol.tcm.TCMessageHeader;
11: import com.tc.net.protocol.tcm.TCMessageType;
12: import com.tc.object.session.SessionID;
13: import com.tc.object.tx.TxnBatchID;
14:
15: import java.io.IOException;
16:
17: /**
18: * This message sent from server to client when a batch of transactions has completely been apply()'d. This does NOT
19: * mean that the transactions are complete (ie. this ACK should NOT be used to allow a client side commit to complete).
20: */
21: public class BatchTransactionAcknowledgeMessageImpl extends
22: DSOMessageBase implements BatchTransactionAcknowledgeMessage {
23: private static final byte BATCH_ID = 1;
24:
25: private TxnBatchID batchID;
26:
27: public BatchTransactionAcknowledgeMessageImpl(SessionID sessionID,
28: MessageMonitor monitor, TCByteBufferOutput out,
29: MessageChannel channel, TCMessageType type) {
30: super (sessionID, monitor, out, channel, type);
31: }
32:
33: public BatchTransactionAcknowledgeMessageImpl(SessionID sessionID,
34: MessageMonitor monitor, MessageChannel channel,
35: TCMessageHeader header, TCByteBuffer[] data) {
36: super (sessionID, monitor, channel, header, data);
37: }
38:
39: protected void dehydrateValues() {
40: putNVPair(BATCH_ID, batchID.toLong());
41: }
42:
43: protected boolean hydrateValue(byte name) throws IOException {
44: switch (name) {
45: case BATCH_ID: {
46: this .batchID = new TxnBatchID(getLongValue());
47: return true;
48: }
49: default: {
50: return false;
51: }
52: }
53: }
54:
55: public void initialize(TxnBatchID id) {
56: this .batchID = id;
57: }
58:
59: public TxnBatchID getBatchID() {
60: return batchID;
61: }
62: }
|