use of org.apache.hadoop.yarn.proto.YarnServerResourceManagerRecoveryProtos.EpochProto in project hadoop by apache.
the class TestProtos method testProtoCanBePrinted.
@Test
public void testProtoCanBePrinted() throws Exception {
EpochProto proto = EpochProto.newBuilder().setEpoch(100).build();
String protoString = proto.toString();
Assert.assertNotNull(protoString);
}
use of org.apache.hadoop.yarn.proto.YarnServerResourceManagerRecoveryProtos.EpochProto in project hadoop by apache.
the class LeveldbRMStateStore method getAndIncrementEpoch.
@Override
public synchronized long getAndIncrementEpoch() throws Exception {
long currentEpoch = 0;
byte[] dbKeyBytes = bytes(EPOCH_NODE);
try {
byte[] data = db.get(dbKeyBytes);
if (data != null) {
currentEpoch = EpochProto.parseFrom(data).getEpoch();
}
EpochProto proto = Epoch.newInstance(currentEpoch + 1).getProto();
db.put(dbKeyBytes, proto.toByteArray());
} catch (DBException e) {
throw new IOException(e);
}
return currentEpoch;
}
Aggregations