[ https://issues.apache.org/jira/browse/IGNITE-6221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Maxim Muzafarov updated IGNITE-6221: ------------------------------------ Labels: cq_todo (was: ) > 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 > Labels: cq_todo > > 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)]: > {noformat} > Returns: > true if the evaluation passes, otherwise false. > The effect of returning true is that listener will be invoked > {noformat} > Test to reproduce error: > {code:java} > 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; > } > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)