KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > msg > BatchTransactionAcknowledgeMessageImpl


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.object.msg;
5
6 import com.tc.bytes.TCByteBuffer;
7 import com.tc.io.TCByteBufferOutput;
8 import com.tc.net.protocol.tcm.MessageChannel;
9 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 JavaDoc;
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 DSOMessageBase implements
22     BatchTransactionAcknowledgeMessage {
23   private static final byte BATCH_ID = 1;
24
25   private TxnBatchID batchID;
26
27   public BatchTransactionAcknowledgeMessageImpl(MessageMonitor monitor, TCByteBufferOutput out, MessageChannel channel,
28                                                 TCMessageType type) {
29     super(monitor, out, channel, type);
30   }
31
32   public BatchTransactionAcknowledgeMessageImpl(SessionID sessionID, MessageMonitor monitor, MessageChannel channel,
33                                                 TCMessageHeader header, TCByteBuffer[] data) {
34     super(sessionID, monitor, channel, header, data);
35   }
36
37   protected void dehydrateValues() {
38     putNVPair(BATCH_ID, batchID.toLong());
39   }
40
41   protected boolean hydrateValue(byte name) throws IOException JavaDoc {
42     switch (name) {
43       case BATCH_ID: {
44         this.batchID = new TxnBatchID(getLongValue());
45         return true;
46       }
47       default: {
48         return false;
49       }
50     }
51   }
52
53   public void initialize(TxnBatchID id) {
54     this.batchID = id;
55   }
56
57   public TxnBatchID getBatchID() {
58     return batchID;
59   }
60 }
61
Popular Tags