String ridText =
config.getString(GraphDatabaseConfiguration.INSTANCE_RID_RAW_KEY);
try {
tentativeRid = Hex.decodeHex(ridText.toCharArray());
} catch (DecoderException e) {
throw new TitanConfigurationException("Could not decode hex value", e);
}
log.debug("Set rid from hex string: 0x{}", ridText);
} else {
final byte[] endBytes;
if (config.containsKey(GraphDatabaseConfiguration.INSTANCE_RID_SHORT_KEY)) {
short s = config.getShort(
GraphDatabaseConfiguration.INSTANCE_RID_SHORT_KEY);
endBytes = new byte[2];
endBytes[0] = (byte) ((s & 0x0000FF00) >> 8);
endBytes[1] = (byte) (s & 0x000000FF);
} else {
//endBytes = ManagementFactory.getRuntimeMXBean().getName().getBytes();
endBytes = new StringBuilder(String.valueOf(Thread.currentThread().getId()))
.append("@")
.append(ManagementFactory.getRuntimeMXBean().getName())
.toString()
.getBytes();
}
byte[] addrBytes;
try {
addrBytes = Inet4Address.getLocalHost().getAddress();
} catch (UnknownHostException e) {
throw new TitanConfigurationException("Unknown host specified", e);
}
tentativeRid = new byte[addrBytes.length + endBytes.length];
System.arraycopy(addrBytes, 0, tentativeRid, 0, addrBytes.length);
System.arraycopy(endBytes, 0, tentativeRid, addrBytes.length, endBytes.length);