Search in sources :

Example 1 with GridContinuousHandler

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();
    }
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) GridContinuousHandler(org.apache.ignite.internal.processors.continuous.GridContinuousHandler)

Example 2 with GridContinuousHandler

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();
    }
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteFutureImpl(org.apache.ignite.internal.util.future.IgniteFutureImpl) GridContinuousHandler(org.apache.ignite.internal.processors.continuous.GridContinuousHandler)

Example 3 with GridContinuousHandler

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;
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) GridContinuousProcessor(org.apache.ignite.internal.processors.continuous.GridContinuousProcessor) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) GridContinuousHandler(org.apache.ignite.internal.processors.continuous.GridContinuousHandler)

Example 4 with GridContinuousHandler

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;
}
Also used : HashMap(java.util.HashMap) GridContinuousProcessor(org.apache.ignite.internal.processors.continuous.GridContinuousProcessor) ArrayList(java.util.ArrayList) Collection(java.util.Collection) GridContinuousHandler(org.apache.ignite.internal.processors.continuous.GridContinuousHandler)

Aggregations

GridContinuousHandler (org.apache.ignite.internal.processors.continuous.GridContinuousHandler)4 ArrayList (java.util.ArrayList)2 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 GridContinuousProcessor (org.apache.ignite.internal.processors.continuous.GridContinuousProcessor)2 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 IgniteFutureImpl (org.apache.ignite.internal.util.future.IgniteFutureImpl)1