releaseTransport(transport);
}
}
public Map<String, String> stats() {
Transport transport = transportFactory.getTransport();
try {
// 1) write header
long messageId = writeHeader(transport, STATS_REQUEST);
readHeaderAndValidate(transport, messageId, STATS_RESPONSE);
int nrOfStats = transport.readVInt();
Map<String, String> result = new HashMap<String, String>();
for (int i = 0; i < nrOfStats; i++) {
String statName = transport.readString();
String statValue = transport.readString();
result.put(statName, statValue);
}
return result;
} finally {
releaseTransport(transport);