@Override public BootstrapNodeInfo build() { try { BootstrapNodeInfo record = new BootstrapNodeInfo(); record.connectionInfo = fieldSetFlags()[0] ? this.connectionInfo : (org.kaaproject.kaa.server.common.zk.gen.ConnectionInfo) defaultValue(fields()[0]); record.transports = fieldSetFlags()[1] ? this.transports : (java.util.List<org.kaaproject.kaa.server.common.zk.gen.TransportMetaData>) defaultValue(fields()[1]); record.timeStarted = fieldSetFlags()[2] ? this.timeStarted : (java.lang.Long) defaultValue(fields()[2]); return record; } catch (Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } }
/** * Start zk. * * @throws Exception in case of error */ private void startZk() throws Exception { // NOSONAR if (getNodeConfig().isZkEnabled()) { LOG.info("Bootstrap service starting ZooKepper connection to {}", getNodeConfig().getZkHostPortList()); BootstrapNodeInfo nodeInfo = new BootstrapNodeInfo(); ByteBuffer keyData = ByteBuffer.wrap(bootstrapKeyStoreService.getPublicKey().getEncoded()); LOG.trace("Bootstrap service: registering in ZK: thriftHost {}; " + "thriftPort {}; nettyHost {}; nettyPort {}", getNodeConfig().getThriftHost(), getNodeConfig().getThriftPort()); nodeInfo.setConnectionInfo(new ConnectionInfo( getNodeConfig().getThriftHost(), getNodeConfig().getThriftPort(), keyData)); nodeInfo.setTransports(new ArrayList<>()); nodeInfo.setTimeStarted(System.currentTimeMillis()); bootstrapNode = new BootstrapNode(nodeInfo, zkClient); if (bootstrapNode != null) { bootstrapNode.start(); } } }