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:
14: import java.io.IOException;
15:
16: /**
17: * @author steve
18: */
19: public class ObjectIDBatchRequestMessage extends DSOMessageBase {
20: private final static byte REQUEST_ID = 1;
21: private final static byte BATCH_SIZE = 2;
22:
23: private long requestID;
24: private int batchSize;
25:
26: public ObjectIDBatchRequestMessage(SessionID sessionID,
27: MessageMonitor monitor, TCByteBufferOutput out,
28: MessageChannel channel, TCMessageType type) {
29: super (sessionID, monitor, out, channel, type);
30: }
31:
32: public ObjectIDBatchRequestMessage(SessionID sessionID,
33: MessageMonitor monitor, MessageChannel channel,
34: TCMessageHeader header, TCByteBuffer[] data) {
35: super (sessionID, monitor, channel, header, data);
36: }
37:
38: protected void dehydrateValues() {
39: putNVPair(REQUEST_ID, requestID);
40: putNVPair(BATCH_SIZE, batchSize);
41: }
42:
43: protected boolean hydrateValue(byte name) throws IOException {
44: switch (name) {
45: case REQUEST_ID:
46: requestID = getLongValue();
47: return true;
48: case BATCH_SIZE:
49: batchSize = getIntValue();
50: return true;
51: default:
52: return false;
53: }
54: }
55:
56: public void initialize(long reqID, int size) {
57: this .requestID = reqID;
58: this .batchSize = size;
59: }
60:
61: public int getBatchSize() {
62: return batchSize;
63: }
64:
65: public long getRequestID() {
66: return requestID;
67: }
68: }
|