/** {@inheritDoc} */ @Override public GridDiscoveryTopologySnapshot topologySnapshot() throws GridException { get(); if (topSnapshot.get() == null) topSnapshot.compareAndSet(null, new GridDiscoveryTopologySnapshot(discoEvt.topologyVersion(), discoEvt.topologyNodes())); return topSnapshot.get(); }
/** {@inheritDoc} */ @Override public void onEvent(GridEvent evt) { assert evt.type() == EVT_NODE_JOINED || evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED; GridDiscoveryEvent discoEvt = (GridDiscoveryEvent)evt; if (discoEvt.topologyVersion() >= awaitVer) onDone(discoEvt.topologyVersion()); } }
/** * Time coordinator thread constructor. * * @param evt Discovery event on which this node became a coordinator. */ protected TimeCoordinator(GridDiscoveryEvent evt) { super(ctx.gridName(), "grid-time-coordinator", log); lastSnapshot = new GridDiscoveryTopologySnapshot(evt.topologyVersion(), evt.topologyNodes()); }
@Override public void onEvent(GridEvent evt) { int evtType = evt.type(); assert evtType == EVT_NODE_FAILED || evtType == EVT_NODE_LEFT || evtType == EVT_NODE_JOINED; if (affMap.isEmpty()) return; // Skip empty affinity map. final GridDiscoveryEvent discoEvt = (GridDiscoveryEvent)evt; // Clean up affinity functions if such cache no more exists. if (evtType == EVT_NODE_FAILED || evtType == EVT_NODE_LEFT) { final Collection<String> caches = new HashSet<>(); for (GridNode gridNode : ctx.discovery().allNodes()) caches.addAll(U.cacheNames(gridNode)); final Collection<AffinityAssignmentKey> rmv = new GridLeanSet<>(); for (AffinityAssignmentKey key : affMap.keySet()) { if (!caches.contains(key.cacheName) || key.topVer < discoEvt.topologyVersion() - 1) rmv.add(key); } ctx.timeout().addTimeoutObject(new GridTimeoutObjectAdapter( GridUuid.fromUuid(ctx.localNodeId()), AFFINITY_MAP_CLEAN_UP_DELAY) { @Override public void onTimeout() { affMap.keySet().removeAll(rmv); } }); } } };
/** * @param evt Discovery event. */ public void onDiscoveryEvent(GridDiscoveryEvent evt) { if (log.isDebugEnabled()) log.debug("Processing discovery event: " + evt); if (evt.type() == GridEventType.EVT_NODE_FAILED || evt.type() == EVT_NODE_LEFT) onNodeLeft(evt.eventNode().id()); synchronized (this) { lastSnapshot = new GridDiscoveryTopologySnapshot(evt.topologyVersion(), evt.topologyNodes()); notifyAll(); } }
@Override public void onEvent(GridEvent evt) { GridDiscoveryEvent discoEvt = (GridDiscoveryEvent)evt; for (String cacheName : nearOrClientCaches) { if (ctx.discovery().cacheAffinityNodes(cacheName, discoEvt.topologyVersion()).isEmpty()) { if (ctx.event().isRecordable(GridEventType.EVT_CACHE_DATA_LOST)) { ctx.event().record(new GridCacheEvent(cacheName, ctx.discovery().localNode(), discoEvt.eventNode(), "All data nodes left", GridEventType.EVT_CACHE_DATA_LOST, 0, false, null, null, null, null, false, null, false, null, null, null)); } } } } }, GridEventType.EVT_NODE_LEFT, GridEventType.EVT_NODE_FAILED);
"order [newOrder=" + n.order() + ", locOrder=" + loc.order() + ']'; boolean set = topVer.setIfGreater(e.topologyVersion()); GridDhtPartitionExchangeId exchId = exchangeId(n.id(), e.topologyVersion(), e.type());
@Override public void run0() { long topVer = ((GridDiscoveryEvent)evt).topologyVersion();
assert discoEvt.topologyVersion() == startTopVer;