ptupitsyn commented on a change in pull request #8960:
URL: https://github.com/apache/ignite/pull/8960#discussion_r609315903
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientCache.java
##########
@@ -747,6 +775,92 @@ else if (qry instanceof SqlFieldsQuery)
));
}
+ /** {@inheritDoc} */
+ @Override public <R> QueryCursor<R> query(ContinuousQuery<K, V> qry,
ClientDisconnectListener disconnectLsnr) {
+ A.ensure(!(qry.getInitialQuery() instanceof ContinuousQuery), "Initial
query for continuous query " +
+ "can't be an instance of another continuous query");
+ A.notNull(qry.getLocalListener(), "Local listener");
+ A.ensure(!qry.isLocal(), "Unsupported Local flag value");
Review comment:
What about a message like `Local query is not supported by thin client`?
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientCache.java
##########
@@ -747,6 +775,92 @@ else if (qry instanceof SqlFieldsQuery)
));
}
+ /** {@inheritDoc} */
+ @Override public <R> QueryCursor<R> query(ContinuousQuery<K, V> qry,
ClientDisconnectListener disconnectLsnr) {
+ A.ensure(!(qry.getInitialQuery() instanceof ContinuousQuery), "Initial
query for continuous query " +
+ "can't be an instance of another continuous query");
+ A.notNull(qry.getLocalListener(), "Local listener");
+ A.ensure(!qry.isLocal(), "Unsupported Local flag value");
+ A.ensure(qry.isAutoUnsubscribe(), "Unsupported AutoUnsubscribe flag
value");
Review comment:
Similarly, `AutoUnsubscribe flag is not supported by thin client`.
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientCache.java
##########
@@ -747,6 +775,92 @@ else if (qry instanceof SqlFieldsQuery)
));
}
+ /** {@inheritDoc} */
+ @Override public <R> QueryCursor<R> query(ContinuousQuery<K, V> qry,
ClientDisconnectListener disconnectLsnr) {
+ A.ensure(!(qry.getInitialQuery() instanceof ContinuousQuery), "Initial
query for continuous query " +
+ "can't be an instance of another continuous query");
+ A.notNull(qry.getLocalListener(), "Local listener");
+ A.ensure(!qry.isLocal(), "Unsupported Local flag value");
+ A.ensure(qry.isAutoUnsubscribe(), "Unsupported AutoUnsubscribe flag
value");
+ A.ensure(qry.getRemoteFilterFactory() == null || qry.getRemoteFilter()
== null,
+ "Should be used either RemoterFilter or RemoteFilterFactory.");
Review comment:
`RemoteFilter and RemoteFilterFactory can't be used together`
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientCache.java
##########
@@ -947,4 +1061,73 @@ private void writeEntries(Map<? extends K, ? extends V>
map, PayloadOutputChanne
serDes.writeObject(out, e.getValue());
});
}
+
+ /**
+ * Adapter to convert CQ listener calls to JCache listener calls.
+ */
+ private static class JCacheEntryListenerAdapter<K, V> implements
CacheEntryUpdatedListener<K, V> {
Review comment:
The file is too big already, can we move those classes to separate files?
##########
File path:
modules/core/src/test/java/org/apache/ignite/internal/client/thin/CacheEntryListenersTest.java
##########
@@ -0,0 +1,708 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.client.thin;
+
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+import javax.cache.Cache;
+import javax.cache.configuration.CacheEntryListenerConfiguration;
+import javax.cache.configuration.FactoryBuilder;
+import javax.cache.configuration.MutableCacheEntryListenerConfiguration;
+import javax.cache.event.CacheEntryCreatedListener;
+import javax.cache.event.CacheEntryEvent;
+import javax.cache.event.CacheEntryExpiredListener;
+import javax.cache.event.CacheEntryRemovedListener;
+import javax.cache.event.CacheEntryUpdatedListener;
+import javax.cache.event.EventType;
+import javax.cache.expiry.CreatedExpiryPolicy;
+import javax.cache.expiry.Duration;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.client.ClientCache;
+import org.apache.ignite.client.ClientDisconnectListener;
+import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.client.Person;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.junit.Test;
+
+import static
org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause;
+import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
+
+/**
+ * Thin client cache entry listeners test.
+ */
+public class CacheEntryListenersTest extends AbstractThinClientTest {
Review comment:
Let's add a test that combines one or more continuous queries with
compute calls: since we use a shared notification mechanism, it would be good
to check this scenario.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]