~ubuntu-branches/ubuntu/intrepid/tomcat5.5/intrepid

« back to all changes in this revision

Viewing changes to container/modules/groupcom/src/share/org/apache/catalina/tribes/group/RpcMessage.java

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-09-27 11:19:17 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060927111917-wov6fmkz3x6rsl68
Tags: 5.5.17-1ubuntu1
(Build-) depend on libmx4j-java (>= 3.0).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 1999,2004 The Apache Software Foundation.
 
3
 * 
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 * 
 
8
 *      http://www.apache.org/licenses/LICENSE-2.0
 
9
 * 
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
package org.apache.catalina.tribes.group;
 
18
 
 
19
import java.io.ObjectInput;
 
20
import java.io.Serializable;
 
21
import java.io.Externalizable;
 
22
import java.io.IOException;
 
23
import java.io.ObjectOutput;
 
24
 
 
25
/**
 
26
 * <p>Title: </p>
 
27
 *
 
28
 * <p>Description: </p>
 
29
 *
 
30
 * <p>Copyright: Copyright (c) 2005</p>
 
31
 *
 
32
 * <p>Company: </p>
 
33
 *
 
34
 * @author not attributable
 
35
 * @version 1.0
 
36
 */
 
37
public class RpcMessage implements Externalizable {
 
38
 
 
39
    protected Serializable message;
 
40
    protected byte[] uuid;
 
41
    protected byte[] rpcId;
 
42
    protected boolean reply = false;
 
43
 
 
44
    public RpcMessage() {
 
45
        //for serialization
 
46
    }
 
47
 
 
48
    public RpcMessage(byte[] rpcId, byte[] uuid, Serializable message) {
 
49
        this.rpcId = rpcId;
 
50
        this.uuid = uuid;
 
51
        this.message = message;
 
52
    }
 
53
 
 
54
    public void readExternal(ObjectInput in) throws IOException,ClassNotFoundException {
 
55
        reply = in.readBoolean();
 
56
        int length = in.readInt();
 
57
        uuid = new byte[length];
 
58
        in.read(uuid, 0, length);
 
59
        length = in.readInt();
 
60
        rpcId = new byte[length];
 
61
        in.read(rpcId, 0, length);
 
62
        message = (Serializable)in.readObject();
 
63
    }
 
64
 
 
65
    public void writeExternal(ObjectOutput out) throws IOException {
 
66
        out.writeBoolean(reply);
 
67
        out.writeInt(uuid.length);
 
68
        out.write(uuid, 0, uuid.length);
 
69
        out.writeInt(rpcId.length);
 
70
        out.write(rpcId, 0, rpcId.length);
 
71
        out.writeObject(message);
 
72
    }
 
73
 
 
74
}