/** {@inheritDoc} */ @Override public boolean isEnabled(int type) { if (type < 0) throw new IllegalArgumentException("Invalid event type: " + type); return ctx.event().isUserRecordable(type); }
/** {@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; }
/** {@inheritDoc} */ @Override public <T extends Event> IgniteFuture<T> waitForLocalAsync(@Nullable IgnitePredicate<T> filter, @Nullable int... types) throws IgniteException { guard(); try { return new IgniteFutureImpl<>(ctx.event().waitForEvent(filter, 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 boolean stopLocalListen(IgnitePredicate<? extends Event> lsnr, @Nullable int... types) { A.notNull(lsnr, "lsnr"); guard(); try { return ctx.event().removeLocalEventListener(lsnr, types); } finally { unguard(); } }
/** {@inheritDoc} */ @Override public void onTimeout() { if (finishing.get()) return; timedOut = true; U.warn(log, "Job has timed out: " + ses); cancel(); if (!internal && ctx.event().isRecordable(EVT_JOB_TIMEDOUT)) recordEvent(EVT_JOB_TIMEDOUT, "Job has timed out: " + job); }
/** {@inheritDoc} */ @Override public void onKernalStop() { if (discoLsnr != null) { ctx.event().removeLocalEventListener(discoLsnr); if (log.isDebugEnabled()) log.debug("Unregistered deployment discovery listener: " + discoLsnr); } }
/** {@inheritDoc} */ @Override protected void onKernalStop0(boolean cancel) { synchronized (genEcnKeyMux) { stopped = true; if (ioLsnr != null) ctx.io().removeMessageListener(TOPIC_GEN_ENC_KEY, ioLsnr); if (discoLsnr != null) ctx.event().removeDiscoveryEventListener(discoLsnr, EVT_NODE_LEFT, EVT_NODE_FAILED); cancelFutures("Kernal stopped."); } }
/** Initializes future. */ private void init() { ctx.event().addLocalEventListener(this, EVT_NODE_JOINED, EVT_NODE_LEFT, EVT_NODE_FAILED); // Close potential window. long topVer = ctx.discovery().topologyVersion(); if (topVer >= awaitVer) onDone(topVer); }
/** {@inheritDoc} */ @Override protected void start0() throws IgniteCheckedException { super.start0(); cctx.kernalContext().event().addLocalEventListener(discoLsnr, EVT_NODE_LEFT, EVT_NODE_FAILED); cachesRegistry = new CachesRegistry(cctx); }
/** {@inheritDoc} */ @Override public void enableLocal(int[] types) { A.notEmpty(types, "types"); guard(); try { ctx.event().enableEvents(types); } finally { unguard(); } }
/** {@inheritDoc} */ @Override public <T extends Event> IgniteFuture<List<T>> remoteQueryAsync(IgnitePredicate<T> p, long timeout, @Nullable int... types) throws IgniteException { guard(); try { return new IgniteFutureImpl<>(ctx.event().remoteEventsAsync(compoundPredicate(p, types), prj.nodes(), timeout)); } finally { unguard(); } }
/** {@inheritDoc} */ @Override protected void body() { assert job != null; startTime = U.currentTimeMillis(); isStarted = true; // Event notification. evtLsnr.onJobStarted(this); if (!internal && ctx.event().isRecordable(EVT_JOB_STARTED)) recordEvent(EVT_JOB_STARTED, /*no message for success*/null); execute0(true); }
/** {@inheritDoc} */ @Override public void localListen(IgnitePredicate<? extends Event> lsnr, int[] types) { A.notNull(lsnr, "lsnr"); A.notEmpty(types, "types"); guard(); try { ctx.event().addLocalEventListener(lsnr, types); } finally { unguard(); } }
/** {@inheritDoc} */ @Override public void onActivate(GridKernalContext ctx) { if (log.isDebugEnabled()) log.debug("Activating data structure processor [nodeId=" + ctx.localNodeId() + " topVer=" + ctx.discovery().topologyVersionEx() + " ]"); initFailed = false; qryIdMap.clear(); ctx.event().addLocalEventListener(lsnr, EVT_NODE_LEFT, EVT_NODE_FAILED); restoreStructuresState(ctx); onKernalStart0(); }
/** {@inheritDoc} */ @Override public void onDeActivate(GridKernalContext ctx) { if (log.isDebugEnabled()) log.debug("DeActivate data structure processor [nodeId=" + ctx.localNodeId() + ", topVer=" + ctx.discovery().topologyVersionEx() + "]"); ctx.event().removeLocalEventListener(lsnr, EVT_NODE_LEFT, EVT_NODE_FAILED); onKernalStop(false); initLatch = null; for (GridCacheRemovable v : dsMap.values()) { if (v instanceof IgniteChangeGlobalStateSupport) ((IgniteChangeGlobalStateSupport)v).onDeActivate(ctx); } }
/** {@inheritDoc} */ @Override public void stop(boolean cancel) throws IgniteCheckedException { if (!isEnabled) return; ctx.io().removeMessageListener(GridTopic.TOPIC_AUTH, ioLsnr); ctx.event().removeDiscoveryEventListener(discoLsnr, DISCO_EVT_TYPES); cancelFutures("Node stopped"); if (!cancel) exec.shutdown(); else exec.shutdownNow(); }
/** * Updates IGFS metrics when the stream is closed. */ protected void updateMetricsOnClose() { IgfsLocalMetrics metrics = igfsCtx.metrics(); metrics.addWrittenBytesTime(bytes, time); metrics.decrementFilesOpenedForWrite(); GridEventStorageManager evts = igfsCtx.kernalContext().event(); if (evts.isRecordable(EVT_IGFS_FILE_CLOSED_WRITE)) evts.record(new IgfsEvent(path, igfsCtx.localNode(), EVT_IGFS_FILE_CLOSED_WRITE, bytes)); }
/** * Constructor. */ protected FragmentizerCoordinator() { super(igfsCtx.kernalContext().igniteInstanceName(), "fragmentizer-coordinator", igfsCtx.kernalContext().log(IgfsFragmentizerManager.class)); igfsCtx.kernalContext().event().addLocalEventListener(this, EVT_NODE_LEFT, EVT_NODE_FAILED); igfsCtx.kernalContext().io().addMessageListener(topic, this); }