1 46 package org.mr.core.stats.cmc; 47 48 import java.io.IOException ; 49 50 import org.mr.core.util.byteable.Byteable; 51 import org.mr.core.util.byteable.ByteableInputStream; 52 import org.mr.core.util.byteable.ByteableOutputStream; 53 import org.mr.core.util.byteable.ByteableRegistry; 54 55 64 public class CMCAgentStats implements Byteable { 65 private long totalMem; 66 private long freeMem; 67 private long totalMessages; 68 private long totalBytes; 69 private long fiveMinMessages; 70 private long fiveMinBytes; 71 72 public CMCAgentStats() {} 74 78 public long getTotalMem() { 79 return totalMem; 80 } 81 82 86 public void setTotalMem(long newTotalMem) { 87 this.totalMem = newTotalMem; 88 } 89 90 94 public long getFreeMem() { 95 return freeMem; 96 } 97 98 102 public void setFreeMem(long newFreeMem) { 103 this.freeMem = newFreeMem; 104 } 105 106 110 public long getTotalMessages() { 111 return totalMessages; 112 } 113 114 118 public void setTotalMessages(long newTotalMessages) { 119 this.totalMessages = newTotalMessages; 120 } 121 122 126 public long getTotalBytes() { 127 return totalBytes; 128 } 129 130 134 public void setTotalBytes(long newTotalBytes) { 135 this.totalBytes = newTotalBytes; 136 } 137 138 public String getByteableName() { 140 return "org.mr.core.stats.cmc.CMCAgentStats"; 141 } 142 143 public void toBytes(ByteableOutputStream out) throws IOException { 144 out.writeLong(this.totalMem); 145 out.writeLong(this.freeMem); 146 out.writeLong(this.totalMessages); 147 out.writeLong(this.totalBytes); 148 out.writeLong(this.fiveMinMessages); 149 out.writeLong(this.fiveMinBytes); 150 } 151 152 public Byteable createInstance(ByteableInputStream in) throws IOException { 153 CMCAgentStats stats = new CMCAgentStats(); 154 stats.totalMem = in.readLong(); 155 stats.freeMem = in.readLong(); 156 stats.totalMessages = in.readLong(); 157 stats.totalBytes = in.readLong(); 158 stats.fiveMinMessages = in.readLong(); 159 stats.fiveMinBytes = in.readLong(); 160 return stats; 161 } 162 163 public void registerToByteableRegistry() { 164 ByteableRegistry.registerByteableFactory(getByteableName(), this); 165 } 166 167 public static void register() { 168 CMCAgentStats stats = new CMCAgentStats(); 169 stats.registerToByteableRegistry(); 170 } 171 174 public long getFiveMinBytes() { 175 return fiveMinBytes; 176 } 177 180 public void setFiveMinBytes(long fiveMinBytes) { 181 this.fiveMinBytes = fiveMinBytes; 182 } 183 186 public long getFiveMinMessages() { 187 return fiveMinMessages; 188 } 189 192 public void setFiveMinMessages(long fiveMinMessages) { 193 this.fiveMinMessages = fiveMinMessages; 194 } 195 } | Popular Tags |