PageRenderTime 15ms CodeModel.GetById 7ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/hazelcast/src/main/java/com/hazelcast/impl/management/ConnectionInfo.java

https://bitbucket.org/gabral6_gmailcom/hazelcast
Java | 74 lines | 43 code | 13 blank | 18 comment | 0 complexity | b6f1500301e9f5e3af181b1492b9e0e6 MD5 | raw file
 1/*
 2 * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
 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
17package com.hazelcast.impl.management;
18
19import com.hazelcast.nio.DataSerializable;
20
21import java.io.DataInput;
22import java.io.DataOutput;
23import java.io.IOException;
24
25/**
26 * @mdogan 5/8/12
27 */
28public class ConnectionInfo implements DataSerializable {
29
30    private int memberIndex;
31    private long lastRead;
32    private long lastWrite;
33    private boolean live;
34
35    public ConnectionInfo() {
36    }
37
38    public ConnectionInfo(final int memberIndex, final boolean live, final long lastRead, final long lastWrite) {
39        this.lastRead = lastRead;
40        this.lastWrite = lastWrite;
41        this.live = live;
42        this.memberIndex = memberIndex;
43    }
44
45    public long getLastRead() {
46        return lastRead;
47    }
48
49    public long getLastWrite() {
50        return lastWrite;
51    }
52
53    public boolean isLive() {
54        return live;
55    }
56
57    public int getMemberIndex() {
58        return memberIndex;
59    }
60
61    public void writeData(DataOutput out) throws IOException {
62        out.writeInt(memberIndex);
63        out.writeLong(lastRead);
64        out.writeLong(lastWrite);
65        out.writeBoolean(live);
66    }
67
68    public void readData(DataInput in) throws IOException {
69        memberIndex = in.readInt();
70        lastRead = in.readLong();
71        lastWrite = in.readLong();
72        live = in.readBoolean();
73    }
74}