/** {@inheritDoc} */ @Override public void run() { finishFutures(disconnectError()); busyLock.block(); busyLock.unblock(); doReconnect(newId); } }
/** * Stops processing of services deployments tasks. * * @param stopErr Cause error of deployment manager stop. */ void stopProcessing(IgniteCheckedException stopErr) { busyLock.block(); try { ctx.event().removeDiscoveryEventListener(discoLsnr); ctx.io().removeMessageListener(commLsnr); U.cancel(depWorker); U.join(depWorker, log); depWorker.tasksQueue.clear(); pendingEvts.clear(); tasks.values().forEach(t -> t.completeError(stopErr)); tasks.clear(); } finally { busyLock.unblock(); } }
/** * */ public void reconnect() { assert clientReconnectEnabled; synchronized (stateMux) { if (connState == ConnectionState.STARTED) { connState = ConnectionState.DISCONNECTED; rtState.onCloseStart(disconnectError()); } else return; } busyLock.block(); busyLock.unblock(); rtState.zkClient.close(); UUID newId = UUID.randomUUID(); U.quietAndWarn(log, "Local node will try to reconnect to cluster with new id due to network problems [" + "newId=" + newId + ", prevId=" + locNode.id() + ", locNode=" + locNode + ']'); runInWorkerThread(new ReconnectClosure(newId)); }
/** * @param e Error. */ private void stop0(Throwable e) { if (!stop.compareAndSet(false, true)) return; ZkRuntimeState rtState = this.rtState; if (rtState.zkClient != null && rtState.locNodeZkPath != null && rtState.zkClient.connected()) { try { rtState.zkClient.deleteIfExistsNoRetry(rtState.locNodeZkPath, -1); } catch (Exception err) { if (log.isDebugEnabled()) log.debug("Failed to delete local node's znode on stop: " + err); } } IgniteCheckedException err = new IgniteCheckedException("Node stopped."); synchronized (stateMux) { connState = ConnectionState.STOPPED; rtState.onCloseStart(err); } IgniteUtils.shutdownNow(ZookeeperDiscoveryImpl.class, utilityPool, log); busyLock.block(); busyLock.unblock(); joinFut.onDone(e); ZookeeperClient zkClient = rtState.zkClient; if (zkClient != null) zkClient.close(); finishFutures(err); }