/** * Removes local event listener. * * @param lsnr Local event listener. */ public void removeListener(GridLocalEventListener lsnr) { cctx.gridEvents().removeLocalEventListener(lsnr); }
/** {@inheritDoc} */ @Override public void onKernalStop0(boolean cancel) { cctx.gridEvents().removeLocalEventListener(discoLsnr); }
/** {@inheritDoc} */ @Override public void unregister(UUID routineId, GridKernalContext ctx) { assert routineId != null; assert ctx != null; if (lsnr != null) ctx.event().removeLocalEventListener(lsnr, types); }
/** * Removes user listener for specified events, if any. If no event types provided - it * removes the listener for all its registered events. * * @param lsnr User listener predicate. * @param types Event types. * @return Returns {@code true} if removed. */ public boolean removeLocalEventListener(GridPredicate<? extends GridEvent> lsnr, @Nullable int... types) { return removeLocalEventListener(new UserListenerWrapper(lsnr), types); }
/** {@inheritDoc} */ @Override public void onEvent(GridEvent evt) { if (!lsnr.apply(evt)) removeLocalEventListener(this); }
/** {@inheritDoc} */ @Override protected void stop0(boolean cancel) { cctx.gridEvents().removeLocalEventListener(discoLsnr, EVT_NODE_METRICS_UPDATED); }
/** {@inheritDoc} */ @Override public boolean onDone(@Nullable Long res, @Nullable Throwable err) { if (super.onDone(res, err)) { ctx.event().removeLocalEventListener(this, EVT_NODE_JOINED, EVT_NODE_LEFT, EVT_NODE_FAILED); return true; } return false; }
@Override public boolean removeLocalEventListener(GridLocalEventListener lsnr) { A.notNull(lsnr, "lsnr"); return ctx.event().removeLocalEventListener(lsnr); }
/** {@inheritDoc} */ @Override public void onKernalStop(boolean cancel) { if (ctx != null && ctx.event() != null) ctx.event().removeLocalEventListener(lsnr); }
@Override public void onEvent(GridEvent evt) { if (p == null || p.apply((T)evt)) { fut.onDone((T)evt); removeLocalEventListener(this); } } }, F.isEmpty(types) ? GridEventType.EVTS_ALL : types);
@Override public void onEvent(GridEvent evt) { if (p == null || p.apply(evt)) { fut.onDone(evt); removeLocalEventListener(this); } } }, types);
/** {@inheritDoc} */ @Override public boolean stopLocalListen(GridPredicate<? extends GridEvent> lsnr, @Nullable int... types) { A.notNull(lsnr, "lsnr"); guard(); try { return ctx.event().removeLocalEventListener(lsnr, types); } finally { unguard(); } }
/** {@inheritDoc} */ @Override public void onKernalStop() { if (discoLsnr != null) { ctx.event().removeLocalEventListener(discoLsnr); if (log.isDebugEnabled()) log.debug("Unregistered deployment discovery listener: " + discoLsnr); } }
/** {@inheritDoc} */ @Override public void onKernalStop() { if (discoLsnr != null) { ctx.event().removeLocalEventListener(discoLsnr); if (log.isDebugEnabled()) log.debug("Unregistered deployment discovery listener: " + discoLsnr); } }
/** {@inheritDoc} */ @SuppressWarnings("BusyWait") @Override public void onKernalStop0(boolean cancel) { // No more communication messages. getSpi().setListener(null); busyLock.writeLock(); U.shutdownNow(getClass(), affPool, log); boolean interrupted = false; while (workersCnt.sum() != 0) { try { Thread.sleep(200); } catch (InterruptedException ignored) { interrupted = true; } } if (interrupted) Thread.currentThread().interrupt(); GridEventStorageManager evtMgr = ctx.event(); if (evtMgr != null && discoLsnr != null) evtMgr.removeLocalEventListener(discoLsnr); }
/** {@inheritDoc} */ @Override public void stop() { busyLock.block(); // Clear interrupted flag temporarily. boolean interrupted = Thread.interrupted(); // Force all workers to finish their batches. for (GridGgfsFileWorker w : workerMap.values()) w.cancel(); // Wait for all writers to finish their execution. for (GridGgfsFileWorker w : workerMap.values()) { try { w.join(); } catch (InterruptedException e) { U.error(log, e.getMessage(), e); } } workerMap.clear(); if (secondaryFs instanceof AutoCloseable) U.closeQuiet((AutoCloseable)secondaryFs); ggfsCtx.kernalContext().io().removeMessageListener(topic, delMsgLsnr); ggfsCtx.kernalContext().event().removeLocalEventListener(delDiscoLsnr); if (interrupted) Thread.currentThread().interrupt(); }
/** {@inheritDoc} */ @Override public void stop() { busyLock.block(); // Clear interrupted flag temporarily. boolean interrupted = Thread.interrupted(); // Force all workers to finish their batches. for (GridGgfsFileWorker w : workerMap.values()) w.cancel(); // Wait for all writers to finish their execution. for (GridGgfsFileWorker w : workerMap.values()) { try { w.join(); } catch (InterruptedException e) { U.error(log, e.getMessage(), e); } } workerMap.clear(); if (secondaryFs instanceof AutoCloseable) U.closeQuiet((AutoCloseable)secondaryFs); ggfsCtx.kernalContext().io().removeMessageListener(topic, delMsgLsnr); ggfsCtx.kernalContext().event().removeLocalEventListener(delDiscoLsnr); if (interrupted) Thread.currentThread().interrupt(); }
/** * @param cancel {@code True} to close with cancellation. * @throws GridException If failed. */ @Override public void close(boolean cancel) throws GridException { if (!closed.compareAndSet(false, true)) return; busyLock.block(); if (log.isDebugEnabled()) log.debug("Closing data loader [ldr=" + this + ", cancel=" + cancel + ']'); GridException e = null; try { // Assuming that no methods are called on this loader after this method is called. if (cancel) { cancelled = true; for (Buffer buf : bufMappings.values()) buf.cancelAll(); } else doFlush(); ctx.event().removeLocalEventListener(discoLsnr); ctx.io().removeMessageListener(topic); } catch (GridException e0) { e = e0; } fut.onDone(null, e); if (e != null) throw e; }
ctx.event().removeLocalEventListener(discoLsnr);
ctx.event().removeLocalEventListener(topLsnr);