@Override public boolean apply(Event evt) { assert evt.type() == EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST; CacheRebalancingEvent cacheEvt = (CacheRebalancingEvent)evt; if (cacheEvt.partition() == part0 && F.eq(cacheName, cacheEvt.cacheName())) { latch.countDown(); // Auto-unsubscribe. return false; } return true; } }, EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST);
/** {@inheritDoc} */ @Override public String toString() { return S.toString(CacheRebalancingEvent.class, this, "discoEvtName", discoveryEventName(), "nodeId8", U.id8(node().id()), "msg", message(), "type", name(), "tstamp", timestamp()); } }
/** {@inheritDoc} */ @Override public String shortDisplay() { return name() + ": cache=" + CU.mask(cacheName) + ", cause=" + discoveryEventName(); }
writer.writeString(event0.cacheName()); writer.writeInt(event0.partition()); writeNode(writer, event0.discoveryNode()); writer.writeInt(event0.discoveryEventType()); writer.writeString(event0.discoveryEventName()); writer.writeLong(event0.discoveryTimestamp());
/** * @param evts Events. * @param g Grid. * @param parts Parts. */ private void checkPartitionUnloadEvents(Collection<Event> evts, Ignite g, Collection<GridDhtLocalPartition> parts) { assertEquals(parts.size(), evts.size()); for (Event evt : evts) { CacheRebalancingEvent unloadEvt = (CacheRebalancingEvent)evt; final int part = unloadEvt.partition(); assertNotNull("Unexpected partition: " + part, F.find(parts, null, new IgnitePredicate<GridDhtLocalPartition>() { @Override public boolean apply(GridDhtLocalPartition e) { return e.id() == part; } })); assertEquals(g.cache(DEFAULT_CACHE_NAME).getName(), unloadEvt.cacheName()); assertEquals(g.cluster().localNode().id(), unloadEvt.node().id()); } } }
/** * 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)); }
/** {@inheritDoc} */ @Override public boolean apply(Event evt) { lostParts.add(((CacheRebalancingEvent)evt).partition()); return true; } }
writer.writeString(event0.cacheName()); writer.writeInt(event0.partition()); writeNode(writer, event0.discoveryNode()); writer.writeInt(event0.discoveryEventType()); writer.writeString(event0.discoveryEventName()); writer.writeLong(event0.discoveryTimestamp());
/** * 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)); } }
/** {@inheritDoc} */ @Override public String shortDisplay() { return name() + ": cache=" + CU.mask(cacheName) + ", cause=" + discoveryEventName(); }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(CacheRebalancingEvent.class, this, "discoEvtName", discoveryEventName(), "nodeId8", U.id8(node().id()), "msg", message(), "type", name(), "tstamp", timestamp()); } }
"clsName", "clause", null, null, null, uuid, "taskName", 1, 2, 3, 4)); ctx.writeEvent(writer, new CacheRebalancingEvent("cacheName", node, msg, evtType, 1, node, 2, 3));
/** * 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 (int i = 0; i < caches.size(); i++) { GridCacheContext cctx = caches.get(i); 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)); } }
cctx.gridEvents().record(new CacheRebalancingEvent(cctx.name(), cctx.localNode(), "Cache rebalancing event.",