use of com.linkedin.kafka.cruisecontrol.metricsreporter.exception.UnknownVersionException in project cruise-control by linkedin.
the class PartitionMetricSample method fromBytes.
public static PartitionMetricSample fromBytes(byte[] bytes) throws UnknownVersionException {
ByteBuffer buffer = ByteBuffer.wrap(bytes);
// Not used at this point.
byte version = buffer.get();
if (version > CURRENT_VERSION) {
throw new UnknownVersionException("Metric sample version " + version + " is higher than current version " + CURRENT_VERSION);
}
switch(version) {
case 0:
return readV0(buffer);
case 1:
return readV1(buffer);
default:
throw new IllegalStateException("Should never be here.");
}
}
use of com.linkedin.kafka.cruisecontrol.metricsreporter.exception.UnknownVersionException in project cruise-control by linkedin.
the class BrokerMetricSample method fromBytes.
/**
* Deserialize the bytes to get a broker metric data.
* @param bytes the bytes to deserialize.
* @return the deserialized broker metric sample.
* @throws UnknownVersionException
*/
public static BrokerMetricSample fromBytes(byte[] bytes) throws UnknownVersionException {
ByteBuffer buffer = ByteBuffer.wrap(bytes);
byte version = buffer.get();
if (version > CURRENT_VERSION) {
throw new UnknownVersionException("The model broker metric sample version " + version + " is higher than the current" + "version " + CURRENT_VERSION);
}
switch(version) {
case 0:
return readV0(buffer);
case 1:
return readV1(buffer);
case 2:
return readV2(buffer);
case 3:
return readV3(buffer);
default:
throw new IllegalStateException("Should never be here");
}
}
Aggregations