@Override public boolean apply(T t) { for (int type : types) { if (type == t.type()) return p.apply(t); } return false; } };
@Override public boolean apply(Event evt) { if (evt.type() == EVT_CLIENT_NODE_DISCONNECTED) { info("Disconnected: " + evt); disconnectLatch.countDown(); } else if (evt.type() == EVT_CLIENT_NODE_RECONNECTED) { info("Reconnected: " + evt); reconnectLatch.countDown(); } return true; } }, EVT_CLIENT_NODE_DISCONNECTED, EVT_CLIENT_NODE_RECONNECTED);
@Override public boolean apply(Event evt) { if (evt.type() == EVT_CLIENT_NODE_RECONNECTED) { info("Reconnected: " + evt); reconnectLatch.countDown(); } return true; } }, EVT_CLIENT_NODE_RECONNECTED);
@Override public boolean apply(Event evt) { assert evt.type() == EventType.EVT_NODE_METRICS_UPDATED; latch.countDown(); return true; } };
@Override public boolean apply(Event evt) { assert evt.type() == EventType.EVT_NODE_JOINED; info(">>> Event: " + evt); joined.countDown(); return true; } }, EventType.EVT_NODE_JOINED);
@Override public boolean apply(Event evt) { switch (evt.type()) { case EVT_CACHE_OBJECT_LOCKED: lockCnt.countDown(); break; case EVT_CACHE_OBJECT_UNLOCKED: unlockCnt.countDown(); break; } return true; } }, EVT_CACHE_OBJECT_LOCKED, EVT_CACHE_OBJECT_UNLOCKED);
/** {@inheritDoc} */ @Override public boolean apply(Event evt) { assert evt.type() == EVT_CACHE_ENTRY_EVICTED; evictCnt.incrementAndGet(); evictLatch.countDown(); return true; } }
@Override public boolean apply(UUID nodeId, Event evt) { info("Event from " + nodeId + " [" + evt.shortDisplay() + ']'); assertEquals(EVT_JOB_STARTED, evt.type()); nodeIds.add(nodeId); cnt.incrementAndGet(); latch.countDown(); return true; } }),
@Override public boolean apply(UUID nodeId, Event evt) { info("Event from " + nodeId + " [" + evt.shortDisplay() + ']'); assertEquals(EVT_JOB_STARTED, evt.type()); nodeIds.add(nodeId); cnt.incrementAndGet(); latch.countDown(); return true; } },
@Override public void onEvent(Event evt) { assert evt.type() == EVT_NODE_FAILED || evt.type() == EVT_NODE_LEFT; DiscoveryEvent discoEvt = (DiscoveryEvent)evt; if (igfsCtx.igfsNode(discoEvt.eventNode())) { for (WriteCompletionFuture future : pendingWrites.values()) { future.onError(discoEvt.eventNode().id(), new ClusterTopologyCheckedException("Node left grid before write completed: " + evt.node().id())); } } } }, EVT_NODE_LEFT, EVT_NODE_FAILED);
/** * Checks that specified event is not task or job event. * * @param evt Event to check. */ private void checkGridInternalEvent(Event evt) { assertFalse("Found TASK event for task marked with @GridInternal [evtType=" + evt.type() + "]", evt instanceof TaskEvent); assertFalse("Found JOB event for task marked with @GridInternal [evtType=" + evt.type() + "]", evt instanceof JobEvent); }
@Override public void recordEvent(Event evt) { A.notNull(evt, "evt"); if (ctx.event().isRecordable(evt.type())) ctx.event().record(evt); }
@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);
@Override public void onEvent(Event evt) { assert evt.type() == EVT_NODE_METRICS_UPDATED; DiscoveryEvent discoEvt = (DiscoveryEvent)evt; ClusterNode node = cctx.discovery().node(discoEvt.node().id()); if (node != null && !node.id().equals(cctx.localNodeId())) onReceived(discoEvt.eventNode().id(), node.metrics().getLastDataVersion()); } };
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { ignite = G.ignite(getTestIgniteInstanceName()); long tstamp = startTimestamp(); ignite.compute().localDeployTask(GridAllEventsTestTask.class, GridAllEventsTestTask.class.getClassLoader()); List<Event> evts = pullEvents(tstamp, 1); assertEvent(evts.get(0).type(), EVT_TASK_DEPLOYED, evts); }