/** * Gets name of discovery event that triggered this preloading event. * * @return Name of discovery event that triggered this preloading event. * @see GridDiscoveryEvent#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(GridSpiContext spiCtx) throws GridSpiException { if (!isPerTask) balancer.onContextInitialized(spiCtx); else { if (!getSpiContext().isEventRecordable(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED)) throw new GridSpiException("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); } }
/** * Adds local event listener. * * @param lsnr Listener to add. * @param type Event type to subscribe listener for. * @param types Additional event types to subscribe listener for. */ public void addLocalEventListener(GridLocalEventListener lsnr, int type, @Nullable int... types) { assert lsnr != null; if (!enterBusy()) return; try { getOrCreate(type).add(lsnr); if (!isRecordable(type)) U.warn(log, "Added listener for disabled event type: " + U.gridEventName(type)); if (types != null) { for (int t : types) { getOrCreate(t).add(lsnr); if (!isRecordable(t)) U.warn(log, "Added listener for disabled event type: " + U.gridEventName(t)); if (t == GridEventType.EVT_NODE_RECONNECTED) U.warn(log, "Added local listener for deprecated EVT_NODE_RECONNECT event " + "(local listener will never get called)."); } } } finally { leaveBusy(); } }
/** * Adds local event listener. Note that this method specifically disallow an empty * array of event type to prevent accidental subscription for all system event that * may lead to a drastic performance decrease. * * @param lsnr Listener to add. * @param types Event types to subscribe listener for. */ public void addLocalEventListener(GridLocalEventListener lsnr, int[] types) { assert lsnr != null; assert types != null; assert types.length > 0; if (!enterBusy()) return; try { for (int t : types) { getOrCreate(t).add(lsnr); if (!isRecordable(t)) U.warn(log, "Added listener for disabled event type: " + U.gridEventName(t)); if (t == GridEventType.EVT_NODE_RECONNECTED) U.warn(log, "Added local listener for deprecated EVT_NODE_RECONNECT event " + "(local listener will never get called)."); } } finally { leaveBusy(); } }
/** * Notify external listener on discovery event. * * @param type Discovery event type. See {@link GridDiscoveryEvent} for more details. * @param topVer Topology version. * @param node Remote node this event is connected with. */ private void notifyDiscovery(int type, long topVer, GridTcpDiscoveryNode node) { assert type > 0; assert node != null; GridDiscoverySpiListener lsnr = this.lsnr; GridTcpDiscoverySpiState spiState = spiStateCopy(); if (lsnr != null && node.visible() && (spiState == CONNECTED || spiState == DISCONNECTING)) { Collection<GridNode> top = new ArrayList<GridNode>(F.view(ring.allNodes(), VISIBLE_NODES)); Map<Long, Collection<GridNode>> hist = updateTopologyHistory(topVer, top); lsnr.onDiscovery(type, topVer, node, top, hist); } else if (log.isDebugEnabled()) log.debug("Skipped discovery notification [node=" + node + ", spiState=" + spiState + ", type=" + U.gridEventName(type) + ", topVer=" + topVer + ']'); }
/** * Adds partition unload event. * * @param part Partition. */ public void addUnloadEvent(int part) { if (!cctx.events().isRecordable(EVT_CACHE_PRELOAD_PART_UNLOADED)) LT.warn(log, null, "Added event without checking if event is recordable: " + U.gridEventName(EVT_CACHE_PRELOAD_PART_UNLOADED)); cctx.gridEvents().record(new GridCachePreloadingEvent(cctx.name(), cctx.localNode(), "Cache unloading event.", EVT_CACHE_PRELOAD_PART_UNLOADED, part, null, 0, 0)); }
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 preloading event. * * @param part Partition. * @param type Event type. * @param discoNode Discovery node. * @param discoType Discovery event type. * @param discoTs Discovery event timestamp. */ public void addPreloadEvent(int part, int type, GridNode discoNode, int discoType, long discoTs) { assert discoNode != null; assert type > 0; assert discoType > 0; assert discoTs > 0; if (!cctx.events().isRecordable(type)) LT.warn(log, null, "Added event without checking if event is recordable: " + U.gridEventName(type)); cctx.gridEvents().record(new GridCachePreloadingEvent(cctx.name(), cctx.localNode(), "Cache preloading event.", type, part, discoNode, discoType, discoTs)); }
/** * Records event if it's recordable. * * @param evt Event to record. */ public void record(GridEvent evt) { assert evt != null; if (!enterBusy()) return; try { int type = evt.type(); if (!isRecordable(type)) { LT.warn(log, null, "Trying to record event without checking if it is recordable: " + U.gridEventName(type)); } // Override user recordable settings for daemon node. if ((isDaemon || isUserRecordable(type)) && !isHiddenEvent(type)) try { getSpi().record(evt); } catch (GridSpiException e) { U.error(log, "Failed to record event: " + evt, e); } if (isRecordable(type)) notifyListeners(evt); } finally { leaveBusy(); } }
LT.warn(log, null, "Added event without checking if event is recordable: " + U.gridEventName(type));