/** * @return Discovery event name. */ public String discoveryEventName() { return U.gridEventName(evt); }
/** * Gets name of discovery event that triggered this rebalancing event. * * @return Name of discovery event that triggered this rebalancing event. * @see DiscoveryEvent#name() */ public String discoveryEventName() { return U.gridEventName(discoEvtType); }
/** * Gets event type name. * * @return Event type name. */ @Override public String name() { return U.gridEventName(type()); }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(GridDhtPartitionExchangeId.class, this, "nodeId", U.id8(nodeId), "evt", U.gridEventName(evt)); } }
/** {@inheritDoc} */ @Override protected void onContextInitialized0(IgniteSpiContext spiCtx) throws IgniteSpiException { if (!isPerTask) balancer.onContextInitialized(spiCtx); else { if (!getSpiContext().isEventRecordable(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED)) throw new IgniteSpiException("Required event types are disabled: " + U.gridEventName(EVT_TASK_FAILED) + ", " + U.gridEventName(EVT_TASK_FINISHED) + ", " + U.gridEventName(EVT_JOB_MAPPED)); getSpiContext().addLocalEventListener(lsnr, EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED); } }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(EventTypeFuture.class, this, "evtName", U.gridEventName(evtType)); } }
/** * @param lsnr Listener. * @param type Event type. */ private void registerListener(ListenerWrapper lsnr, Integer type) { Listeners lsnrs0 = lsnrs.get(type); if (lsnrs0 == null) { lsnrs0 = new Listeners(); Listeners prev = lsnrs.putIfAbsent(type, lsnrs0); if (prev != null) lsnrs0 = prev; } lsnrs0.addListener(lsnr); if (!isRecordable(type)) U.warn(log, "Added listener for disabled event type: " + U.gridEventName(type)); }
/** * Notify external listener on discovery event. * * @param type Discovery event type. See {@link org.apache.ignite.events.DiscoveryEvent} for more details. * @param topVer Topology version. * @param node Remote node this event is connected with. */ private void notifyDiscovery(int type, long topVer, TcpDiscoveryNode node) { assert type > 0; assert node != null; DiscoverySpiListener lsnr = spi.lsnr; TcpDiscoverySpiState spiState = spiStateCopy(); DebugLogger log = type == EVT_NODE_METRICS_UPDATED ? traceLog : debugLog; if (lsnr != null && node.visible() && (spiState == CONNECTED || spiState == DISCONNECTING)) { if (log.isDebugEnabled()) log.debug("Discovery notification [node=" + node + ", spiState=" + spiState + ", type=" + U.gridEventName(type) + ", topVer=" + topVer + ']'); Collection<ClusterNode> top = upcast(ring.visibleNodes()); Map<Long, Collection<ClusterNode>> hist = updateTopologyHistory(topVer, top); lsnr.onDiscovery(type, topVer, node, top, hist, null); } else { if (log.isDebugEnabled()) log.debug("Skipped discovery notification [node=" + node + ", spiState=" + spiState + ", type=" + U.gridEventName(type) + ", topVer=" + topVer + ']'); } }
/** * @param evtType Event type. * @param cnt Count. */ void onEvent(int evtType, int cnt) { if (isDone() || this.evtType != evtType) return; if (TEST_INFO) X.println("EventTypeFuture.onEvent() [evtName=" + U.gridEventName(evtType) + ", evtType=" + evtType + ", cnt=" + cnt + ", expCnt=" + expCnt + ']'); this.cnt = cnt; // For partitioned caches we allow extra event for reads. if (expCnt < cnt && (!partitioned || evtType != EVT_CACHE_OBJECT_READ || expCnt + 1 < cnt)) onDone(new IgniteCheckedException("Wrong event count [evtName=" + U.gridEventName(evtType) + ", evtType=" + evtType + ", expCnt=" + expCnt + ", actCnt=" + cnt + ", partitioned=" + partitioned + "]")); if (expCnt == cnt || (partitioned && expCnt + 1 == cnt)) onDone(); }
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") @Override public boolean apply() { Map<T2<Integer, Long>, DiscoveryEvent> nodeEvts = evts.get(nodeId); if (nodeEvts == null) { info.accept("No events for node: " + nodeId); return false; } synchronized (nodeEvts) { for (DiscoveryEvent expEvt : expEvts) { DiscoveryEvent evt0 = nodeEvts.get(new T2<>(clusterNum.get(), expEvt.topologyVersion())); if (evt0 == null) { info.accept("No event for version: " + expEvt.topologyVersion()); return false; } Assert.assertEquals("Unexpected event [topVer=" + expEvt.topologyVersion() +//todo check ", exp=" + U.gridEventName(expEvt.type()) + ", evt=" + evt0 + ']', expEvt.type(), evt0.type()); } } return true; } }, 30000));
U.warn(log, "Can't disable event since it was enabled in configuration: " + U.gridEventName(type));
log.debug("Event recordable status [type=" + U.gridEventName(type) + ", recordable=" + recordableEvts[type] + ", userRecordable=" + userRecordableEvts[type] + ']');
/** * Adds partition unload event. * * @param part Partition. */ public void addUnloadEvent(int part) { if (!eventRecordable(EVT_CACHE_REBALANCE_PART_UNLOADED)) LT.warn(log, "Added event without checking if event is recordable: " + U.gridEventName(EVT_CACHE_REBALANCE_PART_UNLOADED)); List<GridCacheContext> caches = this.caches; for (GridCacheContext cctx : caches) if (!cctx.config().isEventsDisabled()) cctx.gridEvents().record(new CacheRebalancingEvent(cctx.name(), cctx.localNode(), "Cache unloading event.", EVT_CACHE_REBALANCE_PART_UNLOADED, part, null, 0, 0)); }
/** * Adds rebalancing event. * * @param part Partition. * @param type Event type. * @param discoNode Discovery node. * @param discoType Discovery event type. * @param discoTs Discovery event timestamp. */ public void addRebalanceEvent(int part, int type, ClusterNode discoNode, int discoType, long discoTs) { assert discoNode != null; assert type > 0; assert discoType > 0; assert discoTs > 0; if (!eventRecordable(type)) LT.warn(log, "Added event without checking if event is recordable: " + U.gridEventName(type)); List<GridCacheContext> caches = this.caches; for (GridCacheContext cctx : caches) if (!cctx.config().isEventsDisabled() && cctx.recordEvent(type)) { cctx.gridEvents().record(new CacheRebalancingEvent(cctx.name(), cctx.localNode(), "Cache rebalancing event.", type, part, discoNode, discoType, discoTs)); } }
U.gridEventName(type));
", evt=" + U.gridEventName(type) + ']';
/** * @return Discovery event name. */ public String discoveryEventName() { return U.gridEventName(evt); }
/** * Gets event type name. * * @return Event type name. */ @Override public String name() { return U.gridEventName(type()); }
LT.warn(log, "Added event without checking if event is recordable: " + U.gridEventName(type));
/** {@inheritDoc} */ @Override public String toString() { return S.toString(GridDhtPartitionExchangeId.class, this, "nodeId", U.id8(nodeId), "evt", U.gridEventName(evt)); } }