KickJava   Java API By Example, From Geeks To Geeks.

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


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
14 import java.io.IOException JavaDoc;
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(MessageMonitor monitor, TCByteBufferOutput out, MessageChannel channel, TCMessageType type) {
27     super(monitor, out, channel, type);
28   }
29
30   public ObjectIDBatchRequestMessage(SessionID sessionID, MessageMonitor monitor, MessageChannel channel, TCMessageHeader header, TCByteBuffer[] data) {
31     super(sessionID, monitor, channel, header, data);
32   }
33
34   protected void dehydrateValues() {
35     putNVPair(REQUEST_ID, requestID);
36     putNVPair(BATCH_SIZE, batchSize);
37   }
38
39   protected boolean hydrateValue(byte name) throws IOException JavaDoc {
40     switch (name) {
41       case REQUEST_ID:
42         requestID = getLongValue();
43         return true;
44       case BATCH_SIZE:
45         batchSize = getIntValue();
46         return true;
47       default:
48         return false;
49     }
50   }
51
52   public void initialize(long reqID, int size) {
53     this.requestID = reqID;
54     this.batchSize = size;
55   }
56
57   public int getBatchSize() {
58     return batchSize;
59   }
60
61   public long getRequestID() {
62     return requestID;
63   }
64 }
Popular Tags