use of org.apache.ignite.internal.processors.continuous.GridContinuousHandler in project ignite by apache.
the class IgniteMessagingImpl method remoteListen.
/**
* {@inheritDoc}
*/
@Override
public UUID remoteListen(@Nullable Object topic, IgniteBiPredicate<UUID, ?> p) {
A.notNull(p, "p");
guard();
try {
GridContinuousHandler hnd = new GridMessageListenHandler(topic, securityAwareBiPredicate(p));
return saveOrGet(ctx.continuous().startRoutine(hnd, false, 1, 0, false, prj.predicate()));
} catch (IgniteCheckedException e) {
throw U.convertException(e);
} finally {
unguard();
}
}
use of org.apache.ignite.internal.processors.continuous.GridContinuousHandler in project ignite by apache.
the class IgniteMessagingImpl method remoteListenAsync.
/**
* {@inheritDoc}
*/
@Override
public IgniteFuture<UUID> remoteListenAsync(@Nullable Object topic, IgniteBiPredicate<UUID, ?> p) throws IgniteException {
A.notNull(p, "p");
guard();
try {
GridContinuousHandler hnd = new GridMessageListenHandler(topic, securityAwareBiPredicate(p));
return new IgniteFutureImpl<>(ctx.continuous().startRoutine(hnd, false, 1, 0, false, prj.predicate()));
} catch (IgniteCheckedException e) {
throw U.convertException(e);
} finally {
unguard();
}
}
use of org.apache.ignite.internal.processors.continuous.GridContinuousHandler in project ignite by apache.
the class CacheContinuousQueryFailoverAbstractSelfTest method backupQueue.
/**
* @param ignite Ignite.
* @return Backup queue for test query.
*/
private Collection<Object> backupQueue(Ignite ignite) {
GridContinuousProcessor proc = ((IgniteKernal) ignite).context().continuous();
ConcurrentMap<Object, Object> infos = GridTestUtils.getFieldValue(proc, "rmtInfos");
Collection<Object> backupQueue = new ArrayList<>();
for (Object info : infos.values()) {
GridContinuousHandler hnd = GridTestUtils.getFieldValue(info, "hnd");
if (hnd.isQuery() && hnd.cacheName().equals(DEFAULT_CACHE_NAME)) {
Map<Integer, CacheContinuousQueryEventBuffer> map = GridTestUtils.getFieldValue(hnd, CacheContinuousQueryHandler.class, "entryBufs");
for (CacheContinuousQueryEventBuffer buf : map.values()) {
Collection<Object> q = GridTestUtils.getFieldValue(buf, CacheContinuousQueryEventBuffer.class, "backupQ");
if (q != null)
backupQueue.addAll(q);
}
}
}
return backupQueue;
}
use of org.apache.ignite.internal.processors.continuous.GridContinuousHandler in project ignite by apache.
the class IgniteCacheContinuousQueryBackupQueueTest method backupQueues.
/**
* @param ignite Ignite.
* @return Backup queue for test query.
*/
private List<Collection<Object>> backupQueues(Ignite ignite) {
GridContinuousProcessor proc = ((IgniteKernal) ignite).context().continuous();
Map<Object, Object> infos = new HashMap<>();
Map<Object, Object> rmtInfos = GridTestUtils.getFieldValue(proc, "rmtInfos");
Map<Object, Object> locInfos = GridTestUtils.getFieldValue(proc, "locInfos");
infos.putAll(rmtInfos);
infos.putAll(locInfos);
List<Collection<Object>> backupQueues = new ArrayList<>();
for (Object info : infos.values()) {
GridContinuousHandler hnd = GridTestUtils.getFieldValue(info, "hnd");
if (hnd.isQuery() && hnd.cacheName().equals(CACHE_NAME)) {
Map<Integer, CacheContinuousQueryEventBuffer> map = GridTestUtils.getFieldValue(hnd, CacheContinuousQueryHandler.class, "entryBufs");
for (CacheContinuousQueryEventBuffer buf : map.values()) {
Collection<Object> q = GridTestUtils.getFieldValue(buf, CacheContinuousQueryEventBuffer.class, "backupQ");
if (q != null)
backupQueues.add(q);
}
}
}
return backupQueues;
}
Aggregations