1 package com.quikj.server.framework; 2 3 public class AceIPCHeartbeatMessage implements AceIPCMessageInterface 4 { 5 6 10 11 public static final int TOLERANCE_FACTOR = 3; 13 protected AceIPCHeartbeatMessage (byte[] msg, int length) throws AceException 15 { 16 message = msg; 17 msgLength = length; 18 } 19 20 protected AceIPCHeartbeatMessage () 22 { 23 msgLength = MSG_HEADER_LENGTH; 24 message = new byte [msgLength]; 25 26 message [MSG_TYPE_OFFSET] = HB_MSG; 28 } 29 30 public int getIPCMsgType() 31 { 32 return message[MSG_TYPE_OFFSET]; 33 } 34 35 public int getLength() 36 { 37 return msgLength; 38 } 39 40 public String traceIPCMessage(boolean entire_message) 41 { 42 if (entire_message == true) 43 { 44 return (AceIPCMessage.dumpRawBytes (message, 0, msgLength)); 45 } 46 else 47 { 48 return (new String ("HEARTBEAT")); 49 } 50 } 51 52 public byte[] getBytes() 53 { 54 return message; 55 } 56 57 private static final int MSG_HEADER_LENGTH = 1; 58 59 private byte[] message; 60 private int msgLength; 61 } 62 | Popular Tags |