use of org.voltcore.utils.InstanceId in project voltdb by VoltDB.
the class HostMessenger method getInstanceId.
/**
* Get a unique ID for this cluster
* @return
*/
public InstanceId getInstanceId() {
if (m_instanceId == null) {
try {
byte[] data = m_zk.getData(CoreZK.instance_id, false, null);
JSONObject idJSON = new JSONObject(new String(data, "UTF-8"));
m_instanceId = new InstanceId(idJSON.getInt("coord"), idJSON.getLong("timestamp"));
} catch (Exception e) {
String msg = "Unable to get instance ID info from " + CoreZK.instance_id;
m_hostLog.error(msg);
throw new RuntimeException(msg, e);
}
}
return m_instanceId;
}
Aggregations