/** * Clear all status before next iteration. */ private void clear(Properties props) { synchronized(LOCK) { // clear and wait for next iteration. this.closeIterResults(); this.iterResults.clear(); this.initIterResults(props); this.indexMap.clear(); this.canUpdateWorkerResultMap = true; } }
znode = getMasterBaseNode(context.getAppId()).toString(); getZooKeeper().createExt(znode, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, true); } catch (KeeperException.NodeExistsException e) { LOG.warn("Node exists: {}", znode); znode = getCurrentMasterNode(context.getAppId(), GuaguaConstants.GUAGUA_INIT_STEP).toString(); if(getZooKeeper().exists(znode, false) == null) { String znodeValue = InetAddress.getLocalHost().getHostName() + ":" + NettyMasterCoordinator.this.messageServerPort + ":" + 1; getZooKeeper().createExt(znode, znodeValue.getBytes(Charset.forName("UTF-8")), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false); LOG.info("Master znode initialization with server info {}", znodeValue); } else { String existZnodeValue = new String(getZooKeeper().getData(znode, null, null), Charset.forName("UTF-8")); int version = NumberFormatUtils.getInt(existZnodeValue.split(":")[2], true); String znodeValue = InetAddress.getLocalHost().getHostName() + ":" + NettyMasterCoordinator.this.messageServerPort + ":" + (version + 1); getZooKeeper().createOrSetExt(znode, znodeValue.getBytes(Charset.forName("UTF-8")), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, false, -1); LOG.info("Master znode re-initialization with server info {}", znodeValue);
public void preApplication(final MasterContext<MASTER_RESULT, WORKER_RESULT> context) { initialize(context.getProps()); NettyMasterCoordinator.serializer = (Serializer<Bytable>) getWorkerSerializer(); startNettyServer(context.getProps()); initMasterZnode(context); this.clear(context.getProps());
final long start = System.nanoTime(); if(Boolean.TRUE.toString().equalsIgnoreCase(zkCleanUpEnabled)) { new RetryCoordinatorCommand(isFixedTime(), getSleepTime()) { @Override public boolean retryExecution() throws KeeperException, InterruptedException { getZooKeeper().deleteExt(appNode, -1, true); } catch (KeeperException.NoNodeException e) { if(System.nanoTime() % 20 == 0) {
updateMasterHaltStatus(context); final long start = System.nanoTime(); try { byte[] bytes = getMasterSerializer().objectToBytes(context.getMasterResult()); isSplit = setBytesToZNode(appCurrentMasterNode, appCurrentMasterSplitNode, bytes, CreateMode.PERSISTENT);
new RetryCoordinatorCommand(isFixedTime(), getSleepTime()) {
@Override protected void initialize(Properties props) { super.initialize(props); initIterResults(props); }