use of org.apache.ignite.internal.util.typedef.PE in project ignite by apache.
the class GridCacheMarshallingNodeJoinSelfTest method testNodeJoin.
/**
* @throws Exception If failed.
*/
public void testNodeJoin() throws Exception {
final CountDownLatch allowJoin = new CountDownLatch(1);
final CountDownLatch joined = new CountDownLatch(2);
for (int i = 0; i < 2; i++) {
ignite(i).events().localListen(new PE() {
@Override
public boolean apply(Event evt) {
assert evt.type() == EventType.EVT_NODE_JOINED;
info(">>> Event: " + evt);
joined.countDown();
return true;
}
}, EventType.EVT_NODE_JOINED);
}
IgniteInternalFuture<?> oneMoreGrid = multithreadedAsync(new Callable<Object>() {
@Override
public Object call() throws Exception {
allowJoin.await();
startGrid("oneMoreGrid");
return null;
}
}, 1);
IgniteCache<Integer, TestObject> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
try (Transaction tx = ignite(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
cache.get(0);
allowJoin.countDown();
joined.await();
assertNotNull(cache.get(1));
tx.commit();
}
oneMoreGrid.get();
assertNotNull(cache.get(1));
}
use of org.apache.ignite.internal.util.typedef.PE in project ignite by apache.
the class GridTaskTimeoutSelfTest method checkTimedOutEvents.
/**
* @param execId Execution ID.
*/
private void checkTimedOutEvents(final IgniteUuid execId) {
Ignite ignite = G.ignite(getTestIgniteInstanceName());
Collection<Event> evts = ignite.events().localQuery(new PE() {
@Override
public boolean apply(Event evt) {
return ((TaskEvent) evt).taskSessionId().equals(execId);
}
}, EVT_TASK_TIMEDOUT);
assert evts.size() == 1 : "Invalid number of timed out tasks: " + evts.size();
}
Aggregations