|
@@ -71,16 +71,16 @@ public class GangliaContext extends AbstractMetricsContext {
|
|
|
typeTable.put(Float.class, "float");
|
|
|
}
|
|
|
|
|
|
- private byte[] buffer = new byte[BUFFER_SIZE];
|
|
|
- private int offset;
|
|
|
+ protected byte[] buffer = new byte[BUFFER_SIZE];
|
|
|
+ protected int offset;
|
|
|
|
|
|
- private List<? extends SocketAddress> metricsServers;
|
|
|
+ protected List<? extends SocketAddress> metricsServers;
|
|
|
private Map<String,String> unitsTable;
|
|
|
private Map<String,String> slopeTable;
|
|
|
private Map<String,String> tmaxTable;
|
|
|
private Map<String,String> dmaxTable;
|
|
|
|
|
|
- private DatagramSocket datagramSocket;
|
|
|
+ protected DatagramSocket datagramSocket;
|
|
|
|
|
|
/** Creates a new instance of GangliaContext */
|
|
|
public GangliaContext() {
|
|
@@ -132,7 +132,7 @@ public class GangliaContext extends AbstractMetricsContext {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void emitMetric(String name, String type, String value)
|
|
|
+ protected void emitMetric(String name, String type, String value)
|
|
|
throws IOException {
|
|
|
String units = getUnits(name);
|
|
|
int slope = getSlope(name);
|
|
@@ -156,7 +156,7 @@ public class GangliaContext extends AbstractMetricsContext {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private String getUnits(String metricName) {
|
|
|
+ protected String getUnits(String metricName) {
|
|
|
String result = unitsTable.get(metricName);
|
|
|
if (result == null) {
|
|
|
result = DEFAULT_UNITS;
|
|
@@ -164,7 +164,7 @@ public class GangliaContext extends AbstractMetricsContext {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- private int getSlope(String metricName) {
|
|
|
+ protected int getSlope(String metricName) {
|
|
|
String slopeString = slopeTable.get(metricName);
|
|
|
if (slopeString == null) {
|
|
|
slopeString = DEFAULT_SLOPE;
|
|
@@ -172,7 +172,7 @@ public class GangliaContext extends AbstractMetricsContext {
|
|
|
return ("zero".equals(slopeString) ? 0 : 3); // see gmetric.c
|
|
|
}
|
|
|
|
|
|
- private int getTmax(String metricName) {
|
|
|
+ protected int getTmax(String metricName) {
|
|
|
if (tmaxTable == null) {
|
|
|
return DEFAULT_TMAX;
|
|
|
}
|
|
@@ -185,7 +185,7 @@ public class GangliaContext extends AbstractMetricsContext {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private int getDmax(String metricName) {
|
|
|
+ protected int getDmax(String metricName) {
|
|
|
String dmaxString = dmaxTable.get(metricName);
|
|
|
if (dmaxString == null) {
|
|
|
return DEFAULT_DMAX;
|
|
@@ -200,7 +200,7 @@ public class GangliaContext extends AbstractMetricsContext {
|
|
|
* as an int, followed by the bytes of the string, padded if necessary to
|
|
|
* a multiple of 4.
|
|
|
*/
|
|
|
- private void xdr_string(String s) {
|
|
|
+ protected void xdr_string(String s) {
|
|
|
byte[] bytes = s.getBytes();
|
|
|
int len = bytes.length;
|
|
|
xdr_int(len);
|
|
@@ -222,7 +222,7 @@ public class GangliaContext extends AbstractMetricsContext {
|
|
|
/**
|
|
|
* Puts an integer into the buffer as 4 bytes, big-endian.
|
|
|
*/
|
|
|
- private void xdr_int(int i) {
|
|
|
+ protected void xdr_int(int i) {
|
|
|
buffer[offset++] = (byte)((i >> 24) & 0xff);
|
|
|
buffer[offset++] = (byte)((i >> 16) & 0xff);
|
|
|
buffer[offset++] = (byte)((i >> 8) & 0xff);
|