/** {@inheritDoc} */ @Override public void onKernalStop() { busyLock.block(); }
/** {@inheritDoc} */ @Override public void run() { finishFutures(disconnectError()); busyLock.block(); busyLock.unblock(); doReconnect(newId); } }
/** * Cancel active lazy queries and prevent submit of new queries. */ public void cancelLazyWorkers() { if (!lazyWorkerStopGuard.compareAndSet(false, true)) return; lazyWorkerBusyLock.block(); for (MapQueryLazyWorker worker : lazyWorkers.values()) worker.stop(false); lazyWorkers.clear(); }
/** * Remove callback. */ public void blockOnRemove() { delegate.removed(true); busyLock.block(); }
/** {@inheritDoc} */ @Override protected void onKernalStop0(boolean cancel) { if (ctx.config().isDaemon()) return; busyLock.block(); }
/** {@inheritDoc} */ @Override protected void onKernalStop0(boolean cancel) { IgfsDeleteWorker delWorker0 = delWorker; if (delWorker0 != null) { delWorker0.cancel(); try { U.join(delWorker0); } catch (IgniteInterruptedCheckedException ignored) { // No-op. } } busyLock.block(); }
/** {@inheritDoc} */ @Override public void stop(boolean cancel) { busyLock.block(); // Clear interrupted flag temporarily. boolean interrupted = Thread.interrupted(); if (secondaryFs != null) { // Force all workers to finish their batches. for (IgfsFileWorkerBatch batch : workerMap.values()) batch.cancel(); try { if (secondaryFs instanceof LifecycleAware) ((LifecycleAware)secondaryFs).stop(); } catch (Exception e) { log.error("Failed to close secondary file system.", e); } } // Restore interrupted flag. if (interrupted) Thread.currentThread().interrupt(); if (dualPool != null) dualPool.shutdownNow(); }
/** {@inheritDoc} */ @Override protected void onKernalStop0(boolean cancel) { busyLock.block(); if (queueQryId != null) cctx.continuousQueries().cancelInternalQuery(queueQryId); for (GridCacheQueueProxy q : queuesMap.values()) q.delegate().onKernalStop(); }
/** {@inheritDoc} */ @Override public void onKernalStop(boolean cancel) { super.onKernalStop(cancel); if (cancel && idx != null) { try { while (!busyLock.tryBlock(500)) idx.onKernalStop(); return; } catch (InterruptedException ignored) { U.warn(log, "Interrupted while waiting for active queries cancellation."); Thread.currentThread().interrupt(); } } busyLock.block(); }
/** {@inheritDoc} */ @Override protected void onKernalStop0(boolean cancel) { busyLock.block(); cctx.events().removeListener(lsnr); if (cancel) onCancelAtStop(); else onWaitAtStop(); }
/** {@inheritDoc} */ @Override public void onKernalStop(boolean cancel) { if (srv != null) { busyLock.block(); srv.stop(); ctx.ports().deregisterPorts(getClass()); if (execSvc != null) { U.shutdownNow(getClass(), execSvc, log); execSvc = null; } if (!U.IGNITE_MBEANS_DISABLED) unregisterMBean(); if (log.isDebugEnabled()) log.debug("Client connector processor stopped."); } }
/** * 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)); }
busyLock.block();
/** * @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); }
/** {@inheritDoc} */ @Override public void stop(boolean cancel) throws IgniteCheckedException { busyLock.block(); // Stop receiving notifications. getSpi().setListener(null); // Stop discovery worker and metrics updater. U.closeQuiet(metricsUpdateTask); U.cancel(discoWrk); U.join(discoWrk, log); U.cancel(discoNtfWrk); U.join(discoNtfWrk, log); // Stop SPI itself. stopSpi(); // Stop spi if was not add in spi map but port was open. if (!registeredDiscoSpi) getSpi().spiStop(); registeredDiscoSpi = false; if (log.isDebugEnabled()) log.debug(stopInfo()); }
/** {@inheritDoc} */ @Override public void onKernalStop(boolean cancel) { if (ctx.config().isDaemon()) return; if (!ctx.clientNode()) ctx.io().removeMessageListener(TOPIC_DATASTREAM); busyLock.block(); U.interrupt(flusher); U.join(flusher, log); for (DataStreamerImpl<?, ?> ldr : ldrs) { if (log.isDebugEnabled()) log.debug("Closing active data streamer on grid stop [ldr=" + ldr + ", cancel=" + cancel + ']'); try { ldr.closeEx(cancel); } catch (IgniteInterruptedCheckedException e) { U.warn(log, "Interrupted while waiting for completion of the data streamer: " + ldr, e); } catch (IgniteCheckedException e) { U.error(log, "Failed to close data streamer: " + ldr, e); } } if (log.isDebugEnabled()) log.debug("Stopped data streamer processor."); }
/** * Cancel active lazy queries and prevent submit of new queries. */ public void cancelLazyWorkers() { if (!lazyWorkerStopGuard.compareAndSet(false, true)) return; lazyWorkerBusyLock.block(); for (MapQueryLazyWorker worker : lazyWorkers.values()) worker.stop(false); lazyWorkers.clear(); }
/** {@inheritDoc} */ @Override protected void onKernalStop0(boolean cancel) { busyLock.block(); if (queueQryId != null) cctx.continuousQueries().cancelInternalQuery(queueQryId); for (GridCacheQueueProxy q : queuesMap.values()) q.delegate().onKernalStop(); }
/** {@inheritDoc} */ @Override protected void onKernalStop0(boolean cancel) { busyLock.block(); cctx.events().removeListener(lsnr); if (cancel) onCancelAtStop(); else onWaitAtStop(); }