in folsom/src/main/java/com/spotify/folsom/client/binary/StatsRequest.java [53:72]
public void handle(final BinaryResponse replies, final HostAndPort server) throws IOException {
final Map<String, String> stats = new HashMap<>();
final int expectedOpaque = opaque;
for (final ResponsePacket reply : replies) {
if (OpCode.getKind(reply.opcode) != OpCode.STAT) {
throw new IOException("Unmatched response");
}
final int opaque = reply.opaque;
if (opaque != expectedOpaque) {
throw new IOException("messages out of order for " + getClass().getSimpleName());
}
for (ResponsePacket responsePacket : replies) {
final String name = new String(responsePacket.key, StandardCharsets.US_ASCII);
final String value = new String(responsePacket.value, StandardCharsets.US_ASCII);
stats.put(name, value);
}
}
succeed(
ImmutableMap.of(server.getHostText() + ":" + server.getPort(), new MemcachedStats(stats)));
}