/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. package com.hazelcast.impl.management;
  17. import com.hazelcast.nio.DataSerializable;
  18. import java.io.DataInput;
  19. import java.io.DataOutput;
  20. import java.io.IOException;
  21. /**
  22. * @mdogan 5/8/12
  23. */
  24. public class ConnectionInfo implements DataSerializable {
  25. private int memberIndex;
  26. private long lastRead;
  27. private long lastWrite;
  28. private boolean live;
  29. public ConnectionInfo() {
  30. }
  31. public ConnectionInfo(final int memberIndex, final boolean live, final long lastRead, final long lastWrite) {
  32. this.lastRead = lastRead;
  33. this.lastWrite = lastWrite;
  34. this.live = live;
  35. this.memberIndex = memberIndex;
  36. }
  37. public long getLastRead() {
  38. return lastRead;
  39. }
  40. public long getLastWrite() {
  41. return lastWrite;
  42. }
  43. public boolean isLive() {
  44. return live;
  45. }
  46. public int getMemberIndex() {
  47. return memberIndex;
  48. }
  49. public void writeData(DataOutput out) throws IOException {
  50. out.writeInt(memberIndex);
  51. out.writeLong(lastRead);
  52. out.writeLong(lastWrite);
  53. out.writeBoolean(live);
  54. }
  55. public void readData(DataInput in) throws IOException {
  56. memberIndex = in.readInt();
  57. lastRead = in.readLong();
  58. lastWrite = in.readLong();
  59. live = in.readBoolean();
  60. }
  61. }