Search in sources :

Example 6 with InstanceId

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;
}
Also used : JSONObject(org.json_voltpatches.JSONObject) InstanceId(org.voltcore.utils.InstanceId) JSONException(org.json_voltpatches.JSONException) SocketException(java.net.SocketException) KeeperException(org.apache.zookeeper_voltpatches.KeeperException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

InstanceId (org.voltcore.utils.InstanceId)6 IOException (java.io.IOException)4 JSONException (org.json_voltpatches.JSONException)3 JSONObject (org.json_voltpatches.JSONObject)3 File (java.io.File)2 HashSet (java.util.HashSet)2 JSONArray (org.json_voltpatches.JSONArray)2 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 SocketException (java.net.SocketException)1 ByteBuffer (java.nio.ByteBuffer)1 TreeMap (java.util.TreeMap)1 TreeSet (java.util.TreeSet)1 ExecutionException (java.util.concurrent.ExecutionException)1 PureJavaCrc32 (org.apache.hadoop_voltpatches.util.PureJavaCrc32)1 KeeperException (org.apache.zookeeper_voltpatches.KeeperException)1 Test (org.junit.Test)1 BBContainer (org.voltcore.utils.DBBPool.BBContainer)1 HashinatorSnapshotData (org.voltdb.sysprocs.saverestore.HashinatorSnapshotData)1 TableFiles (org.voltdb.sysprocs.saverestore.SnapshotUtil.TableFiles)1