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.object.msg;
06:
07: import com.tc.async.api.EventContext;
08: import com.tc.bytes.TCByteBuffer;
09: import com.tc.io.TCByteBufferOutput;
10: import com.tc.net.protocol.tcm.MessageChannel;
11: import com.tc.net.protocol.tcm.MessageMonitor;
12: import com.tc.net.protocol.tcm.TCMessageHeader;
13: import com.tc.net.protocol.tcm.TCMessageType;
14: import com.tc.object.session.SessionID;
15: import com.tc.object.tx.TransactionID;
16:
17: import java.io.IOException;
18:
19: public class CompletedTransactionLowWaterMarkMessage extends
20: DSOMessageBase implements EventContext {
21:
22: private static final byte LOW_WATER_MARK = 0;
23:
24: private TransactionID lowWaterMark;
25:
26: public CompletedTransactionLowWaterMarkMessage(SessionID sessionID,
27: MessageMonitor monitor, TCByteBufferOutput out,
28: MessageChannel channel, TCMessageType type) {
29: super (sessionID, monitor, out, channel, type);
30: }
31:
32: public CompletedTransactionLowWaterMarkMessage(SessionID sessionID,
33: MessageMonitor monitor, MessageChannel channel,
34: TCMessageHeader header, TCByteBuffer[] data) {
35: super (sessionID, monitor, channel, header, data);
36: }
37:
38: public void initialize(TransactionID lwm) {
39: this .lowWaterMark = lwm;
40: }
41:
42: protected void dehydrateValues() {
43: putNVPair(LOW_WATER_MARK, lowWaterMark.toLong());
44: }
45:
46: protected boolean hydrateValue(byte name) throws IOException {
47: switch (name) {
48: case LOW_WATER_MARK:
49: this .lowWaterMark = new TransactionID(getLongValue());
50: return true;
51: default:
52: return false;
53: }
54: }
55:
56: public TransactionID getLowWaterMark() {
57: return lowWaterMark;
58: }
59:
60: }
|