ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikolay Izhikov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (IGNITE-6221) ContinuousQuery. Local listener notified if filter throws exception
Date Wed, 30 Aug 2017 08:06:01 GMT
Nikolay Izhikov created IGNITE-6221:

             Summary: ContinuousQuery. Local listener notified if filter throws exception
                 Key: IGNITE-6221
                 URL: https://issues.apache.org/jira/browse/IGNITE-6221
             Project: Ignite
          Issue Type: Bug
          Components: cache
    Affects Versions: 2.1
            Reporter: Nikolay Izhikov
            Priority: Minor
             Fix For: 2.2

Local listener of continuous query receives event if filter throw exception from `evaluate`.

Steps to reproduce the bug:

1. Run continuous query with remote filter.
2. Throw exception from filter.

Current behavior:
3. Local listener notified.
Expected behavior:
3. Local listener doesn't notify.

[Mail-list discussion|http://apache-ignite-developers.2346864.n4.nabble.com/ContinuousQueryWithTransformer-implementation-questions-2-td21418.html]

Filter description from [jcache Javadoc|https://static.javadoc.io/javax.cache/cache-api/1.0.0/javax/cache/event/CacheEntryEventFilter.html#evaluate(javax.cache.event.CacheEntryEvent)]:

   true if the evaluation passes, otherwise false.
   The effect of returning true is that listener will be invoked

Test to reproduce error: 

package org.apache.ignite.internal.processors.cache.query.continuous;

import java.io.Serializable;
import javax.cache.Cache;
import javax.cache.event.CacheEntryEvent;
import javax.cache.event.CacheEntryUpdatedListener;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.query.ContinuousQuery;
import org.apache.ignite.cache.query.QueryCursor;

public class GridCacheContinuousQueryFilterExceptionTest extends GridCacheContinuousQueryAbstractSelfTest
implements Serializable {
     * @throws Exception If failed.
    public void testListenerAfterFilterException() throws Exception {
        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);

        ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();

        qry.setLocalListener(new CacheEntryUpdatedListener<Integer, Integer>() {
            @Override public void onUpdated(Iterable<CacheEntryEvent<? extends Integer,
? extends Integer>> evts) {
                fail("Listener shouldn't be called");

        qry.setRemoteFilter(new CacheEntryEventSerializableFilter<Integer, Integer>()
            @Override public boolean evaluate(CacheEntryEvent<? extends Integer, ? extends
Integer> evt) {
                throw new RuntimeException("Test error.");

        try (QueryCursor<Cache.Entry<Integer, Integer>> ignored = cache.query(qry))
            for (int i = 0; i < 100; i++)
                cache.put(i, i);

    @Override protected CacheMode cacheMode() {
        return CacheMode.REPLICATED;

    @Override protected int gridCount() {
        return 1;

This message was sent by Atlassian JIRA

View raw message