[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330949911
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
 ##
 @@ -2056,13 +2098,16 @@ else if (log.isDebugEnabled())
 private boolean autoUnsubscribe;
 
 /**
+ * @param nodeId Node id.
  * @param prjPred Projection predicate.
  * @param hnd Continuous routine handler.
  * @param bufSize Buffer size.
  * @param interval Interval.
  * @param autoUnsubscribe Automatic unsubscribe flag.
  */
-LocalRoutineInfo(@Nullable IgnitePredicate prjPred,
+LocalRoutineInfo(
+UUID nodeId,
 
 Review comment:
   Ok, I got it.
   But we can do a private build method like this
   ```
   private LocalRoutineInfo localRoutineInfo(@Nullable 
IgnitePredicate prjPred,
   GridContinuousHandler hnd,
   int bufSize,
   long interval,
   boolean autoUnsubscribe) {
   return new LocalRoutineInfo(
   ctx.localNodeId(),
   prjPred,
   hnd,
   bufSize,
   interval,
   autoUnsubscribe
   );
   }
   ```
   The main idea is an encapsulation of getting local node id.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r331003825
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ContinuousQueryView.java
 ##
 @@ -0,0 +1,213 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.ContinuousQueryWithTransformer;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import 
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.RoutineInfo;
+
+import static org.apache.ignite.internal.util.IgniteUtils.toStringSafe;
+
+/**
+ * Continuous query representation for a {@link SystemView}.
+ */
+public class ContinuousQueryView {
+/** Routine info. */
+private final RoutineInfo qry;
+
+/** Continuous query handler. */
+private final GridContinuousHandler hnd;
+
+/** Routine id. */
+private final UUID routineId;
+
+/**
+ * @param routineId Routine id.
+ * @param qry Query info.
+ */
+public ContinuousQueryView(UUID routineId, RoutineInfo qry) {
+this.qry = qry;
+this.hnd = qry.handler();
+this.routineId = routineId;
+}
+
+/** @return Continuous query id. */
+public UUID routineId() {
+return routineId;
+}
+
+/** @return Node id. */
+public UUID nodeId() {
+return qry.nodeId();
+}
+
+/** @return Cache name. */
+@Order
+public String cacheName() {
+return hnd.cacheName();
+}
+
+/** @return Topic for continuous query messages. */
+public String topic() {
+return toStringSafe(hnd.orderedTopic());
+}
+
+/** @return Buffer size. */
+public int bufferSize() {
+return qry.bufferSize();
+}
+
+/** @return Notify interval. */
+public long interval() {
+return qry.interval();
+}
+
+/** @return Auto unsubscribe flag value. */
+public boolean autoUnsubscribe() {
+return qry.autoUnsubscribe();
+}
+
+/** @return {@code True} if continuous query registered to receive events. 
*/
+public boolean isEvents() {
+return hnd.isEvents();
+}
+
+/** @return {@code True} if continuous query registered for messaging. */
+public boolean isMessaging() {
+return hnd.isMessaging();
+}
+
+/** @return {@code True} if regular continuous query. */
+public boolean isQuery() {
+return hnd.isQuery();
+}
+
+/**
+ * @return {@code True} if {@code keepBinary} mode enabled.
+ * @see IgniteCache#withKeepBinary()
+ */
+public boolean keepBinary() {
+return hnd.keepBinary();
+}
+
+/** @return {@code True} if continuous query should receive notification 
for existing entries. */
+public boolean notifyExisting() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.notifyExisting();
+}
+
+/** @return {@code True} if old value required for listener. */
+public boolean oldValueRequired() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.oldValueRequired();
+}
+
+/** @return Last send time. */
+@Order(5)
+public long lastSendTime() {
+return qry.lastSendTime();
+}
+
+/** @return Delayed register flag. */
+public boolean delayedRegister() {
+return qry.delayedRegister();
+}
+
+/**
+ * @return Class name of the local transformed listener.
+ * @see ContinuousQuery#setLocalListener(CacheEntryUpdatedListener)
+ */
+@Order(1)

[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r331003720
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ContinuousQueryView.java
 ##
 @@ -0,0 +1,213 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.ContinuousQueryWithTransformer;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import 
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.RoutineInfo;
+
+import static org.apache.ignite.internal.util.IgniteUtils.toStringSafe;
+
+/**
+ * Continuous query representation for a {@link SystemView}.
+ */
+public class ContinuousQueryView {
+/** Routine info. */
+private final RoutineInfo qry;
+
+/** Continuous query handler. */
+private final GridContinuousHandler hnd;
+
+/** Routine id. */
+private final UUID routineId;
+
+/**
+ * @param routineId Routine id.
+ * @param qry Query info.
+ */
+public ContinuousQueryView(UUID routineId, RoutineInfo qry) {
+this.qry = qry;
+this.hnd = qry.handler();
+this.routineId = routineId;
+}
+
+/** @return Continuous query id. */
+public UUID routineId() {
+return routineId;
+}
+
+/** @return Node id. */
+public UUID nodeId() {
+return qry.nodeId();
+}
+
+/** @return Cache name. */
+@Order
+public String cacheName() {
+return hnd.cacheName();
+}
+
+/** @return Topic for continuous query messages. */
+public String topic() {
+return toStringSafe(hnd.orderedTopic());
+}
+
+/** @return Buffer size. */
+public int bufferSize() {
+return qry.bufferSize();
+}
+
+/** @return Notify interval. */
+public long interval() {
+return qry.interval();
+}
+
+/** @return Auto unsubscribe flag value. */
+public boolean autoUnsubscribe() {
+return qry.autoUnsubscribe();
+}
+
+/** @return {@code True} if continuous query registered to receive events. 
*/
+public boolean isEvents() {
+return hnd.isEvents();
+}
+
+/** @return {@code True} if continuous query registered for messaging. */
+public boolean isMessaging() {
+return hnd.isMessaging();
+}
+
+/** @return {@code True} if regular continuous query. */
+public boolean isQuery() {
+return hnd.isQuery();
+}
+
+/**
+ * @return {@code True} if {@code keepBinary} mode enabled.
+ * @see IgniteCache#withKeepBinary()
+ */
+public boolean keepBinary() {
+return hnd.keepBinary();
+}
+
+/** @return {@code True} if continuous query should receive notification 
for existing entries. */
+public boolean notifyExisting() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.notifyExisting();
+}
+
+/** @return {@code True} if old value required for listener. */
+public boolean oldValueRequired() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.oldValueRequired();
+}
+
+/** @return Last send time. */
+@Order(5)
+public long lastSendTime() {
+return qry.lastSendTime();
+}
+
+/** @return Delayed register flag. */
+public boolean delayedRegister() {
+return qry.delayedRegister();
+}
+
+/**
+ * @return Class name of the local transformed listener.
+ * @see ContinuousQuery#setLocalListener(CacheEntryUpdatedListener)
+ */
+@Order(1)

[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r331003420
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ContinuousQueryView.java
 ##
 @@ -0,0 +1,213 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.ContinuousQueryWithTransformer;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import 
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.RoutineInfo;
+
+import static org.apache.ignite.internal.util.IgniteUtils.toStringSafe;
+
+/**
+ * Continuous query representation for a {@link SystemView}.
+ */
+public class ContinuousQueryView {
+/** Routine info. */
+private final RoutineInfo qry;
+
+/** Continuous query handler. */
+private final GridContinuousHandler hnd;
+
+/** Routine id. */
+private final UUID routineId;
+
+/**
+ * @param routineId Routine id.
+ * @param qry Query info.
+ */
+public ContinuousQueryView(UUID routineId, RoutineInfo qry) {
+this.qry = qry;
+this.hnd = qry.handler();
+this.routineId = routineId;
+}
+
+/** @return Continuous query id. */
+public UUID routineId() {
+return routineId;
+}
+
+/** @return Node id. */
+public UUID nodeId() {
+return qry.nodeId();
+}
+
+/** @return Cache name. */
+@Order
+public String cacheName() {
+return hnd.cacheName();
+}
+
+/** @return Topic for continuous query messages. */
+public String topic() {
+return toStringSafe(hnd.orderedTopic());
+}
+
+/** @return Buffer size. */
+public int bufferSize() {
+return qry.bufferSize();
+}
+
+/** @return Notify interval. */
+public long interval() {
+return qry.interval();
+}
+
+/** @return Auto unsubscribe flag value. */
+public boolean autoUnsubscribe() {
+return qry.autoUnsubscribe();
+}
+
+/** @return {@code True} if continuous query registered to receive events. 
*/
+public boolean isEvents() {
+return hnd.isEvents();
+}
+
+/** @return {@code True} if continuous query registered for messaging. */
+public boolean isMessaging() {
+return hnd.isMessaging();
+}
+
+/** @return {@code True} if regular continuous query. */
+public boolean isQuery() {
+return hnd.isQuery();
+}
+
+/**
+ * @return {@code True} if {@code keepBinary} mode enabled.
+ * @see IgniteCache#withKeepBinary()
+ */
+public boolean keepBinary() {
+return hnd.keepBinary();
+}
+
+/** @return {@code True} if continuous query should receive notification 
for existing entries. */
+public boolean notifyExisting() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.notifyExisting();
+}
+
+/** @return {@code True} if old value required for listener. */
+public boolean oldValueRequired() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.oldValueRequired();
+}
+
+/** @return Last send time. */
+@Order(5)
+public long lastSendTime() {
+return qry.lastSendTime();
+}
+
+/** @return Delayed register flag. */
+public boolean delayedRegister() {
+return qry.delayedRegister();
+}
+
+/**
+ * @return Class name of the local transformed listener.
+ * @see ContinuousQuery#setLocalListener(CacheEntryUpdatedListener)
+ */
+@Order(1)

[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330950474
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ContinuousQueryView.java
 ##
 @@ -0,0 +1,213 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.ContinuousQueryWithTransformer;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import 
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.RoutineInfo;
+
+import static org.apache.ignite.internal.util.IgniteUtils.toStringSafe;
+
+/**
+ * Continuous query representation for a {@link SystemView}.
+ */
+public class ContinuousQueryView {
+/** Routine info. */
+private final RoutineInfo qry;
+
+/** Continuous query handler. */
+private final GridContinuousHandler hnd;
+
+/** Routine id. */
+private final UUID routineId;
+
+/**
+ * @param routineId Routine id.
+ * @param qry Query info.
+ */
+public ContinuousQueryView(UUID routineId, RoutineInfo qry) {
+this.qry = qry;
+this.hnd = qry.handler();
+this.routineId = routineId;
+}
+
+/** @return Continuous query id. */
+public UUID routineId() {
+return routineId;
+}
+
+/** @return Node id. */
+public UUID nodeId() {
+return qry.nodeId();
+}
+
+/** @return Cache name. */
+@Order
+public String cacheName() {
+return hnd.cacheName();
+}
+
+/** @return Topic for continuous query messages. */
+public String topic() {
+return toStringSafe(hnd.orderedTopic());
+}
+
+/** @return Buffer size. */
+public int bufferSize() {
+return qry.bufferSize();
+}
+
+/** @return Notify interval. */
+public long interval() {
+return qry.interval();
+}
+
+/** @return Auto unsubscribe flag value. */
+public boolean autoUnsubscribe() {
+return qry.autoUnsubscribe();
+}
+
+/** @return {@code True} if continuous query registered to receive events. 
*/
+public boolean isEvents() {
+return hnd.isEvents();
+}
+
+/** @return {@code True} if continuous query registered for messaging. */
+public boolean isMessaging() {
+return hnd.isMessaging();
+}
+
+/** @return {@code True} if regular continuous query. */
+public boolean isQuery() {
+return hnd.isQuery();
+}
+
+/**
+ * @return {@code True} if {@code keepBinary} mode enabled.
+ * @see IgniteCache#withKeepBinary()
+ */
+public boolean keepBinary() {
+return hnd.keepBinary();
+}
+
+/** @return {@code True} if continuous query should receive notification 
for existing entries. */
+public boolean notifyExisting() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.notifyExisting();
+}
+
+/** @return {@code True} if old value required for listener. */
+public boolean oldValueRequired() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.oldValueRequired();
+}
+
+/** @return Last send time. */
+@Order(5)
+public long lastSendTime() {
+return qry.lastSendTime();
+}
+
+/** @return Delayed register flag. */
+public boolean delayedRegister() {
+return qry.delayedRegister();
+}
+
+/**
+ * @return Class name of the local transformed listener.
+ * @see ContinuousQuery#setLocalListener(CacheEntryUpdatedListener)
+ */
+@Order(1)

[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330950667
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ContinuousQueryView.java
 ##
 @@ -0,0 +1,213 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.ContinuousQueryWithTransformer;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import 
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.RoutineInfo;
+
+import static org.apache.ignite.internal.util.IgniteUtils.toStringSafe;
+
+/**
+ * Continuous query representation for a {@link SystemView}.
+ */
+public class ContinuousQueryView {
+/** Routine info. */
+private final RoutineInfo qry;
+
+/** Continuous query handler. */
+private final GridContinuousHandler hnd;
+
+/** Routine id. */
+private final UUID routineId;
+
+/**
+ * @param routineId Routine id.
+ * @param qry Query info.
+ */
+public ContinuousQueryView(UUID routineId, RoutineInfo qry) {
+this.qry = qry;
+this.hnd = qry.handler();
+this.routineId = routineId;
+}
+
+/** @return Continuous query id. */
+public UUID routineId() {
+return routineId;
+}
+
+/** @return Node id. */
+public UUID nodeId() {
+return qry.nodeId();
+}
+
+/** @return Cache name. */
+@Order
+public String cacheName() {
+return hnd.cacheName();
+}
+
+/** @return Topic for continuous query messages. */
+public String topic() {
+return toStringSafe(hnd.orderedTopic());
+}
+
+/** @return Buffer size. */
+public int bufferSize() {
+return qry.bufferSize();
+}
+
+/** @return Notify interval. */
+public long interval() {
+return qry.interval();
+}
+
+/** @return Auto unsubscribe flag value. */
+public boolean autoUnsubscribe() {
+return qry.autoUnsubscribe();
+}
+
+/** @return {@code True} if continuous query registered to receive events. 
*/
+public boolean isEvents() {
+return hnd.isEvents();
+}
+
+/** @return {@code True} if continuous query registered for messaging. */
+public boolean isMessaging() {
+return hnd.isMessaging();
+}
+
+/** @return {@code True} if regular continuous query. */
+public boolean isQuery() {
+return hnd.isQuery();
+}
+
+/**
+ * @return {@code True} if {@code keepBinary} mode enabled.
+ * @see IgniteCache#withKeepBinary()
+ */
+public boolean keepBinary() {
+return hnd.keepBinary();
+}
+
+/** @return {@code True} if continuous query should receive notification 
for existing entries. */
+public boolean notifyExisting() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.notifyExisting();
+}
+
+/** @return {@code True} if old value required for listener. */
+public boolean oldValueRequired() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.oldValueRequired();
+}
+
+/** @return Last send time. */
+@Order(5)
+public long lastSendTime() {
+return qry.lastSendTime();
+}
+
+/** @return Delayed register flag. */
+public boolean delayedRegister() {
+return qry.delayedRegister();
+}
+
+/**
+ * @return Class name of the local transformed listener.
+ * @see ContinuousQuery#setLocalListener(CacheEntryUpdatedListener)
+ */
+@Order(1)

[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330950617
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ContinuousQueryView.java
 ##
 @@ -0,0 +1,213 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.ContinuousQueryWithTransformer;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import 
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.RoutineInfo;
+
+import static org.apache.ignite.internal.util.IgniteUtils.toStringSafe;
+
+/**
+ * Continuous query representation for a {@link SystemView}.
+ */
+public class ContinuousQueryView {
+/** Routine info. */
+private final RoutineInfo qry;
+
+/** Continuous query handler. */
+private final GridContinuousHandler hnd;
+
+/** Routine id. */
+private final UUID routineId;
+
+/**
+ * @param routineId Routine id.
+ * @param qry Query info.
+ */
+public ContinuousQueryView(UUID routineId, RoutineInfo qry) {
+this.qry = qry;
+this.hnd = qry.handler();
+this.routineId = routineId;
+}
+
+/** @return Continuous query id. */
+public UUID routineId() {
+return routineId;
+}
+
+/** @return Node id. */
+public UUID nodeId() {
+return qry.nodeId();
+}
+
+/** @return Cache name. */
+@Order
+public String cacheName() {
+return hnd.cacheName();
+}
+
+/** @return Topic for continuous query messages. */
+public String topic() {
+return toStringSafe(hnd.orderedTopic());
+}
+
+/** @return Buffer size. */
+public int bufferSize() {
+return qry.bufferSize();
+}
+
+/** @return Notify interval. */
+public long interval() {
+return qry.interval();
+}
+
+/** @return Auto unsubscribe flag value. */
+public boolean autoUnsubscribe() {
+return qry.autoUnsubscribe();
+}
+
+/** @return {@code True} if continuous query registered to receive events. 
*/
+public boolean isEvents() {
+return hnd.isEvents();
+}
+
+/** @return {@code True} if continuous query registered for messaging. */
+public boolean isMessaging() {
+return hnd.isMessaging();
+}
+
+/** @return {@code True} if regular continuous query. */
+public boolean isQuery() {
+return hnd.isQuery();
+}
+
+/**
+ * @return {@code True} if {@code keepBinary} mode enabled.
+ * @see IgniteCache#withKeepBinary()
+ */
+public boolean keepBinary() {
+return hnd.keepBinary();
+}
+
+/** @return {@code True} if continuous query should receive notification 
for existing entries. */
+public boolean notifyExisting() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.notifyExisting();
+}
+
+/** @return {@code True} if old value required for listener. */
+public boolean oldValueRequired() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.oldValueRequired();
+}
+
+/** @return Last send time. */
+@Order(5)
+public long lastSendTime() {
+return qry.lastSendTime();
+}
+
+/** @return Delayed register flag. */
+public boolean delayedRegister() {
+return qry.delayedRegister();
+}
+
+/**
+ * @return Class name of the local transformed listener.
+ * @see ContinuousQuery#setLocalListener(CacheEntryUpdatedListener)
+ */
+@Order(1)

[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330954308
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 ##
 @@ -461,6 +466,59 @@ public void testClientsConnections() throws Exception {
 }
 }
 
+/** */
+@Test
+public void testContinuousQuery() throws Exception {
+try(IgniteEx g0 = startGrid(0); IgniteEx g1 = startGrid(1)) {
 
 Review comment:
   We should rename 
   g0 -> masterNode
   g1 -> remoteNode.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330950617
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ContinuousQueryView.java
 ##
 @@ -0,0 +1,213 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.ContinuousQueryWithTransformer;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import 
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.RoutineInfo;
+
+import static org.apache.ignite.internal.util.IgniteUtils.toStringSafe;
+
+/**
+ * Continuous query representation for a {@link SystemView}.
+ */
+public class ContinuousQueryView {
+/** Routine info. */
+private final RoutineInfo qry;
+
+/** Continuous query handler. */
+private final GridContinuousHandler hnd;
+
+/** Routine id. */
+private final UUID routineId;
+
+/**
+ * @param routineId Routine id.
+ * @param qry Query info.
+ */
+public ContinuousQueryView(UUID routineId, RoutineInfo qry) {
+this.qry = qry;
+this.hnd = qry.handler();
+this.routineId = routineId;
+}
+
+/** @return Continuous query id. */
+public UUID routineId() {
+return routineId;
+}
+
+/** @return Node id. */
+public UUID nodeId() {
+return qry.nodeId();
+}
+
+/** @return Cache name. */
+@Order
+public String cacheName() {
+return hnd.cacheName();
+}
+
+/** @return Topic for continuous query messages. */
+public String topic() {
+return toStringSafe(hnd.orderedTopic());
+}
+
+/** @return Buffer size. */
+public int bufferSize() {
+return qry.bufferSize();
+}
+
+/** @return Notify interval. */
+public long interval() {
+return qry.interval();
+}
+
+/** @return Auto unsubscribe flag value. */
+public boolean autoUnsubscribe() {
+return qry.autoUnsubscribe();
+}
+
+/** @return {@code True} if continuous query registered to receive events. 
*/
+public boolean isEvents() {
+return hnd.isEvents();
+}
+
+/** @return {@code True} if continuous query registered for messaging. */
+public boolean isMessaging() {
+return hnd.isMessaging();
+}
+
+/** @return {@code True} if regular continuous query. */
+public boolean isQuery() {
+return hnd.isQuery();
+}
+
+/**
+ * @return {@code True} if {@code keepBinary} mode enabled.
+ * @see IgniteCache#withKeepBinary()
+ */
+public boolean keepBinary() {
+return hnd.keepBinary();
+}
+
+/** @return {@code True} if continuous query should receive notification 
for existing entries. */
+public boolean notifyExisting() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.notifyExisting();
+}
+
+/** @return {@code True} if old value required for listener. */
+public boolean oldValueRequired() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.oldValueRequired();
+}
+
+/** @return Last send time. */
+@Order(5)
+public long lastSendTime() {
+return qry.lastSendTime();
+}
+
+/** @return Delayed register flag. */
+public boolean delayedRegister() {
+return qry.delayedRegister();
+}
+
+/**
+ * @return Class name of the local transformed listener.
+ * @see ContinuousQuery#setLocalListener(CacheEntryUpdatedListener)
+ */
+@Order(1)

[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330955287
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 ##
 @@ -461,6 +466,59 @@ public void testClientsConnections() throws Exception {
 }
 }
 
+/** */
+@Test
+public void testContinuousQuery() throws Exception {
+try(IgniteEx g0 = startGrid(0); IgniteEx g1 = startGrid(1)) {
+IgniteCache cache = g0.createCache("cache-1");
+
+try(QueryCursor qry = cache.query(new ContinuousQuery<>()
+.setInitialQuery(new ScanQuery<>())
+.setPageSize(100)
+.setTimeInterval(1000)
+.setLocalListener(evts -> {
+// No-op.
+})
+.setRemoteFilterFactory(() -> evt -> true)
+)) {
+for (int i=0; i<100; i++)
+cache.put(i, i);
+
+SystemView qrys = 
g0.context().systemView().view(CQ_SYS_VIEW);
+
+assertEquals(1, qrys.size());
+
+for (ContinuousQueryView cq : qrys)
+checkContinuousQueryView(g0, cq, true);
+
+qrys = g1.context().systemView().view(CQ_SYS_VIEW);
+
+assertEquals(1, qrys.size());
+
+for (ContinuousQueryView cq : qrys)
+checkContinuousQueryView(g0, cq, false);
 
 Review comment:
   code duplication


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330958330
 
 

 ##
 File path: 
modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/metric/SqlViewExporterSpiTest.java
 ##
 @@ -332,6 +335,80 @@ public void testTransactions() throws Exception {
 assertTrue(res);
 }
 
+/** */
+@Test
+public void testContinuousQuery() throws Exception {
+try(IgniteEx g1 = startGrid(1)) {
 
 Review comment:
   We should rename g1 -> remoteNode


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330949911
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
 ##
 @@ -2056,13 +2098,16 @@ else if (log.isDebugEnabled())
 private boolean autoUnsubscribe;
 
 /**
+ * @param nodeId Node id.
  * @param prjPred Projection predicate.
  * @param hnd Continuous routine handler.
  * @param bufSize Buffer size.
  * @param interval Interval.
  * @param autoUnsubscribe Automatic unsubscribe flag.
  */
-LocalRoutineInfo(@Nullable IgnitePredicate prjPred,
+LocalRoutineInfo(
+UUID nodeId,
 
 Review comment:
   Ok, I got it.
   But we can do a private build method like this
   ```
   private LocalRoutineInfo localRoutineInfo(@Nullable 
IgnitePredicate prjPred,
   GridContinuousHandler hnd,
   int bufSize,
   long interval,
   boolean autoUnsubscribe) {
   return new LocalRoutineInfo(
   ctx.localNodeId(),
   prjPred,
   hnd,
   bufSize,
   interval,
   autoUnsubscribe
   );
   }
   ```
   The main idea is an encapsulation of getting local node id.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330956771
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 ##
 @@ -461,6 +466,59 @@ public void testClientsConnections() throws Exception {
 }
 }
 
+/** */
+@Test
+public void testContinuousQuery() throws Exception {
 
 Review comment:
   Is there any reason why this test has a structure differentiating from the 
testTransactions test?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330950474
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ContinuousQueryView.java
 ##
 @@ -0,0 +1,213 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.ContinuousQueryWithTransformer;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import 
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.RoutineInfo;
+
+import static org.apache.ignite.internal.util.IgniteUtils.toStringSafe;
+
+/**
+ * Continuous query representation for a {@link SystemView}.
+ */
+public class ContinuousQueryView {
+/** Routine info. */
+private final RoutineInfo qry;
+
+/** Continuous query handler. */
+private final GridContinuousHandler hnd;
+
+/** Routine id. */
+private final UUID routineId;
+
+/**
+ * @param routineId Routine id.
+ * @param qry Query info.
+ */
+public ContinuousQueryView(UUID routineId, RoutineInfo qry) {
+this.qry = qry;
+this.hnd = qry.handler();
+this.routineId = routineId;
+}
+
+/** @return Continuous query id. */
+public UUID routineId() {
+return routineId;
+}
+
+/** @return Node id. */
+public UUID nodeId() {
+return qry.nodeId();
+}
+
+/** @return Cache name. */
+@Order
+public String cacheName() {
+return hnd.cacheName();
+}
+
+/** @return Topic for continuous query messages. */
+public String topic() {
+return toStringSafe(hnd.orderedTopic());
+}
+
+/** @return Buffer size. */
+public int bufferSize() {
+return qry.bufferSize();
+}
+
+/** @return Notify interval. */
+public long interval() {
+return qry.interval();
+}
+
+/** @return Auto unsubscribe flag value. */
+public boolean autoUnsubscribe() {
+return qry.autoUnsubscribe();
+}
+
+/** @return {@code True} if continuous query registered to receive events. 
*/
+public boolean isEvents() {
+return hnd.isEvents();
+}
+
+/** @return {@code True} if continuous query registered for messaging. */
+public boolean isMessaging() {
+return hnd.isMessaging();
+}
+
+/** @return {@code True} if regular continuous query. */
+public boolean isQuery() {
+return hnd.isQuery();
+}
+
+/**
+ * @return {@code True} if {@code keepBinary} mode enabled.
+ * @see IgniteCache#withKeepBinary()
+ */
+public boolean keepBinary() {
+return hnd.keepBinary();
+}
+
+/** @return {@code True} if continuous query should receive notification 
for existing entries. */
+public boolean notifyExisting() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.notifyExisting();
+}
+
+/** @return {@code True} if old value required for listener. */
+public boolean oldValueRequired() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.oldValueRequired();
+}
+
+/** @return Last send time. */
+@Order(5)
+public long lastSendTime() {
+return qry.lastSendTime();
+}
+
+/** @return Delayed register flag. */
+public boolean delayedRegister() {
+return qry.delayedRegister();
+}
+
+/**
+ * @return Class name of the local transformed listener.
+ * @see ContinuousQuery#setLocalListener(CacheEntryUpdatedListener)
+ */
+@Order(1)

[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330957675
 
 

 ##
 File path: 
modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/metric/SqlViewExporterSpiTest.java
 ##
 @@ -332,6 +335,80 @@ public void testTransactions() throws Exception {
 assertTrue(res);
 }
 
+/** */
+@Test
+public void testContinuousQuery() throws Exception {
+try(IgniteEx g1 = startGrid(1)) {
+IgniteCache cache = 
ignite.createCache("cache-1");
+
+try(QueryCursor qry = cache.query(new ContinuousQuery<>()
+.setInitialQuery(new ScanQuery<>())
+.setPageSize(100)
+.setTimeInterval(1000)
+.setLocalListener(evts -> {
+// No-op.
+})
+.setRemoteFilterFactory(() -> evt -> true)
+)) {
+for (int i=0; i<100; i++)
+cache.put(i, i);
+
+List> qrys = execute(ignite,
+"SELECT " +
+"  CACHE_NAME, " +
+"  BUFFER_SIZE, " +
+"  INTERVAL, " +
+"  NODE_ID, " +
+"  LOCAL_LISTENER, " +
+"  REMOTE_FILTER, " +
+"  LOCAL_TRANSFORMED_LISTENER, " +
+"  REMOTE_TRANSFORMER " +
+"FROM SYS.QUERY_CONTINUOUS");
+
+assertEquals(1, qrys.size());
+
+for (List cq : qrys)
+checkContinuousQuery(cq, true);
+
+qrys = execute(g1,
+"SELECT " +
+"  CACHE_NAME, " +
+"  BUFFER_SIZE, " +
+"  INTERVAL, " +
+"  NODE_ID, " +
+"  LOCAL_LISTENER, " +
+"  REMOTE_FILTER, " +
+"  LOCAL_TRANSFORMED_LISTENER, " +
+"  REMOTE_TRANSFORMER " +
+"FROM SYS.QUERY_CONTINUOUS");
+
+assertEquals(1, qrys.size());
+
+for (List cq : qrys)
+checkContinuousQuery(cq, false);
 
 Review comment:
   code duplication


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330958602
 
 

 ##
 File path: 
modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/metric/SqlViewExporterSpiTest.java
 ##
 @@ -332,6 +335,80 @@ public void testTransactions() throws Exception {
 assertTrue(res);
 }
 
+/** */
+@Test
+public void testContinuousQuery() throws Exception {
 
 Review comment:
   Is there any reason why this test has a structure differentiating from the 
testTransactions test?


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-03 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330950667
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ContinuousQueryView.java
 ##
 @@ -0,0 +1,213 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.ContinuousQueryWithTransformer;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import 
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.RoutineInfo;
+
+import static org.apache.ignite.internal.util.IgniteUtils.toStringSafe;
+
+/**
+ * Continuous query representation for a {@link SystemView}.
+ */
+public class ContinuousQueryView {
+/** Routine info. */
+private final RoutineInfo qry;
+
+/** Continuous query handler. */
+private final GridContinuousHandler hnd;
+
+/** Routine id. */
+private final UUID routineId;
+
+/**
+ * @param routineId Routine id.
+ * @param qry Query info.
+ */
+public ContinuousQueryView(UUID routineId, RoutineInfo qry) {
+this.qry = qry;
+this.hnd = qry.handler();
+this.routineId = routineId;
+}
+
+/** @return Continuous query id. */
+public UUID routineId() {
+return routineId;
+}
+
+/** @return Node id. */
+public UUID nodeId() {
+return qry.nodeId();
+}
+
+/** @return Cache name. */
+@Order
+public String cacheName() {
+return hnd.cacheName();
+}
+
+/** @return Topic for continuous query messages. */
+public String topic() {
+return toStringSafe(hnd.orderedTopic());
+}
+
+/** @return Buffer size. */
+public int bufferSize() {
+return qry.bufferSize();
+}
+
+/** @return Notify interval. */
+public long interval() {
+return qry.interval();
+}
+
+/** @return Auto unsubscribe flag value. */
+public boolean autoUnsubscribe() {
+return qry.autoUnsubscribe();
+}
+
+/** @return {@code True} if continuous query registered to receive events. 
*/
+public boolean isEvents() {
+return hnd.isEvents();
+}
+
+/** @return {@code True} if continuous query registered for messaging. */
+public boolean isMessaging() {
+return hnd.isMessaging();
+}
+
+/** @return {@code True} if regular continuous query. */
+public boolean isQuery() {
+return hnd.isQuery();
+}
+
+/**
+ * @return {@code True} if {@code keepBinary} mode enabled.
+ * @see IgniteCache#withKeepBinary()
+ */
+public boolean keepBinary() {
+return hnd.keepBinary();
+}
+
+/** @return {@code True} if continuous query should receive notification 
for existing entries. */
+public boolean notifyExisting() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.notifyExisting();
+}
+
+/** @return {@code True} if old value required for listener. */
+public boolean oldValueRequired() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.oldValueRequired();
+}
+
+/** @return Last send time. */
+@Order(5)
+public long lastSendTime() {
+return qry.lastSendTime();
+}
+
+/** @return Delayed register flag. */
+public boolean delayedRegister() {
+return qry.delayedRegister();
+}
+
+/**
+ * @return Class name of the local transformed listener.
+ * @see ContinuousQuery#setLocalListener(CacheEntryUpdatedListener)
+ */
+@Order(1)

[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-02 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330566135
 
 

 ##
 File path: 
modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/metric/SqlViewExporterSpiTest.java
 ##
 @@ -332,6 +336,81 @@ public void testTransactions() throws Exception {
 assertTrue(res);
 }
 
+/** */
+@Test
+public void testContinuousQuery() throws Exception {
+try(IgniteEx g1 = startGrid(1)) {
+IgniteCache cache = 
ignite.createCache("cache-1");
+
+QueryCursor qry = cache.query(new ContinuousQuery<>()
+.setInitialQuery(new ScanQuery<>())
+.setPageSize(100)
+.setTimeInterval(1000)
+.setLocalListener(evts -> {
+// No-op.
+})
+.setRemoteFilterFactory(() -> evt -> true)
+);
+
+for (int i=0; i<100; i++)
+cache.put(i, i);
+
+List> qrys = execute(ignite,
+"SELECT " +
+"  CACHE_NAME, " +
+"  BUFFER_SIZE, " +
+"  INTERVAL, " +
+"  NODE_ID, " +
+"  LOCAL_LISTENER, " +
+"  REMOTE_FILTER, " +
+"  LOCAL_TRANSFORMED_LISTENER, " +
+"  REMOTE_TRANSFORMER " +
+"FROM SYS.QUERY_CONTINUOUS");
+
+assertEquals(1, qrys.size());
+
+//Info on originating node.
+for (List cq : qrys) {
+assertEquals("cache-1", cq.get(0));
+assertEquals(100, cq.get(1));
+assertEquals(1000L, cq.get(2));
+assertEquals(ignite.localNode().id(), cq.get(3));
+//Local listener not null on originating node.
+
assertTrue(cq.get(4).toString().startsWith(getClass().getName()));
+
assertTrue(cq.get(5).toString().startsWith(getClass().getName()));
+assertNull(cq.get(6));
+assertNull(cq.get(7));
+}
+
+qrys = execute(g1,
+"SELECT " +
+"  CACHE_NAME, " +
+"  BUFFER_SIZE, " +
+"  INTERVAL, " +
+"  NODE_ID, " +
+"  LOCAL_LISTENER, " +
+"  REMOTE_FILTER, " +
+"  LOCAL_TRANSFORMED_LISTENER, " +
+"  REMOTE_TRANSFORMER " +
+"FROM SYS.QUERY_CONTINUOUS");
+
+assertEquals(1, qrys.size());
+
+//Info on remote node.
+for (List cq : qrys) {
+assertEquals("cache-1", cq.get(0));
+assertEquals(100, cq.get(1));
+assertEquals(1000L, cq.get(2));
+assertEquals(ignite.localNode().id(), cq.get(3));
+//Local listener is null on remote nodes.
+assertNull(cq.get(4));
+
assertTrue(cq.get(5).toString().startsWith(getClass().getName()));
+assertNull(cq.get(6));
+assertNull(cq.get(7));
+}
 
 Review comment:
   code duplication


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-02 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330563172
 
 

 ##
 File path: 
modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/metric/SqlViewExporterSpiTest.java
 ##
 @@ -332,6 +336,81 @@ public void testTransactions() throws Exception {
 assertTrue(res);
 }
 
+/** */
+@Test
+public void testContinuousQuery() throws Exception {
+try(IgniteEx g1 = startGrid(1)) {
+IgniteCache cache = 
ignite.createCache("cache-1");
+
+QueryCursor qry = cache.query(new ContinuousQuery<>()
 
 Review comment:
   qry is not used.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-02 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330564716
 
 

 ##
 File path: 
modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/metric/SqlViewExporterSpiTest.java
 ##
 @@ -30,10 +30,14 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
 
 Review comment:
   unnecessary import


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-02 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330501207
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ContinuousQueryView.java
 ##
 @@ -0,0 +1,214 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.ContinuousQueryWithTransformer;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import 
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.RoutineInfo;
+
+/**
+ * Continuous query representation for a {@link SystemView}.
+ */
+public class ContinuousQueryView {
+/** Routine info. */
+private final RoutineInfo qry;
+
+/** Continuous query handler. */
+private final GridContinuousHandler hnd;
+
+/** Routine id. */
+private final UUID routineId;
+
+/**
+ * @param routineId Routine id.
+ * @param qry Query info.
+ */
+public ContinuousQueryView(UUID routineId, RoutineInfo qry) {
+this.qry = qry;
+this.hnd = qry.handler();
+this.routineId = routineId;
+}
+
+/** @return Continuous query id. */
+public UUID routineId() {
+return routineId;
+}
+
+/** @return Node id. */
+public UUID nodeId() {
+return qry.nodeId();
+}
+
+/** @return Cache name. */
+@Order
+public String cacheName() {
+return hnd.cacheName();
+}
+
+/** @return Topic for continuous query messages. */
+public String topic() {
+return String.valueOf(hnd.orderedTopic());
+}
+
+/** @return Buffer size. */
+public int bufferSize() {
+return qry.bufferSize();
+}
+
+/** @return Notify interval. */
+public long interval() {
+return qry.interval();
+}
+
+/** @return Auto unsubscribe flag value. */
+public boolean autoUnsubscribe() {
+return qry.autoUnsubscribe();
+}
+
+/** @return {@code True} if continuous query registered to receive events. 
*/
+public boolean isEvents() {
+return hnd.isEvents();
+}
+
+/** @return {@code True} if continuous query registered for messaging. */
+public boolean isMessaging() {
+return hnd.isMessaging();
+}
+
+/** @return {@code True} if regular continuous query. */
+public boolean isQuery() {
+return hnd.isQuery();
+}
+
+/**
+ * @return {@code True} if {@code keepBinary} mode enabled.
+ * @see IgniteCache#withKeepBinary()
+ */
+public boolean keepBinary() {
+return hnd.keepBinary();
+}
+
+/** @return {@code True} if continuous query should receive notification 
for existing entries. */
+public boolean notifyExisting() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.notifyExisting();
+}
+
+/** @return {@code True} if old value required for listener. */
+public boolean oldValueRequired() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+if (hnd0 == null)
+return false;
+
+return hnd0.oldValueRequired();
+}
+
+/** @return Last send time. */
+@Order(5)
+public long lastSendTime() {
+return qry.lastSendTime();
+}
+
+/** @return Delayed register flag. */
+public boolean delayedRegister() {
+return qry.delayedRegister();
+}
+
+/**
+ * @return String representation of local listener.
+ * @see ContinuousQuery#setLocalListener(CacheEntryUpdatedListener)
+ */
+@Order(1)
+public String localListener() {
 

[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-02 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330522293
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ContinuousQueryView.java
 ##
 @@ -0,0 +1,214 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.ContinuousQueryWithTransformer;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import 
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.RoutineInfo;
+
+/**
+ * Continuous query representation for a {@link SystemView}.
+ */
+public class ContinuousQueryView {
+/** Routine info. */
+private final RoutineInfo qry;
+
+/** Continuous query handler. */
+private final GridContinuousHandler hnd;
+
+/** Routine id. */
+private final UUID routineId;
+
+/**
+ * @param routineId Routine id.
+ * @param qry Query info.
+ */
+public ContinuousQueryView(UUID routineId, RoutineInfo qry) {
+this.qry = qry;
+this.hnd = qry.handler();
+this.routineId = routineId;
+}
+
+/** @return Continuous query id. */
+public UUID routineId() {
+return routineId;
+}
+
+/** @return Node id. */
+public UUID nodeId() {
+return qry.nodeId();
+}
+
+/** @return Cache name. */
+@Order
+public String cacheName() {
+return hnd.cacheName();
+}
+
+/** @return Topic for continuous query messages. */
+public String topic() {
+return String.valueOf(hnd.orderedTopic());
 
 Review comment:
   Pay attention that most methods of this class return the null as String, but 
this method returns "null" as String. 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-02 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330496223
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ContinuousQueryView.java
 ##
 @@ -0,0 +1,214 @@
+/*
+ * 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.spi.systemview.view;
+
+import java.util.UUID;
+import javax.cache.configuration.Factory;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.ContinuousQueryWithTransformer;
+import org.apache.ignite.internal.managers.systemview.walker.Order;
+import 
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import 
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.RoutineInfo;
+
+/**
+ * Continuous query representation for a {@link SystemView}.
+ */
+public class ContinuousQueryView {
+/** Routine info. */
+private final RoutineInfo qry;
+
+/** Continuous query handler. */
+private final GridContinuousHandler hnd;
+
+/** Routine id. */
+private final UUID routineId;
+
+/**
+ * @param routineId Routine id.
+ * @param qry Query info.
+ */
+public ContinuousQueryView(UUID routineId, RoutineInfo qry) {
+this.qry = qry;
+this.hnd = qry.handler();
+this.routineId = routineId;
+}
+
+/** @return Continuous query id. */
+public UUID routineId() {
+return routineId;
+}
+
+/** @return Node id. */
+public UUID nodeId() {
+return qry.nodeId();
+}
+
+/** @return Cache name. */
+@Order
+public String cacheName() {
+return hnd.cacheName();
+}
+
+/** @return Topic for continuous query messages. */
+public String topic() {
+return String.valueOf(hnd.orderedTopic());
+}
+
+/** @return Buffer size. */
+public int bufferSize() {
+return qry.bufferSize();
+}
+
+/** @return Notify interval. */
+public long interval() {
+return qry.interval();
+}
+
+/** @return Auto unsubscribe flag value. */
+public boolean autoUnsubscribe() {
+return qry.autoUnsubscribe();
+}
+
+/** @return {@code True} if continuous query registered to receive events. 
*/
+public boolean isEvents() {
+return hnd.isEvents();
+}
+
+/** @return {@code True} if continuous query registered for messaging. */
+public boolean isMessaging() {
+return hnd.isMessaging();
+}
+
+/** @return {@code True} if regular continuous query. */
+public boolean isQuery() {
+return hnd.isQuery();
+}
+
+/**
+ * @return {@code True} if {@code keepBinary} mode enabled.
+ * @see IgniteCache#withKeepBinary()
+ */
+public boolean keepBinary() {
+return hnd.keepBinary();
+}
+
+/** @return {@code True} if continuous query should receive notification 
for existing entries. */
+public boolean notifyExisting() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+return hnd0 != null && hnd0.notifyExisting();
+}
+
+/** @return {@code True} if old value required for listener. */
+public boolean oldValueRequired() {
+CacheContinuousQueryHandler hnd0 = cacheHandler();
+
+if (hnd0 == null)
+return false;
+
+return hnd0.oldValueRequired();
 
 Review comment:
   Can be simplified:
   `return hnd0 != null && hnd0.oldValueRequired();`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-02 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330542891
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 ##
 @@ -461,6 +466,61 @@ public void testClientsConnections() throws Exception {
 }
 }
 
+/** */
+@Test
+public void testContinuousQuery() throws Exception {
+try(IgniteEx g0 = startGrid(0); IgniteEx g1 = startGrid(1)) {
+IgniteCache cache = g0.createCache("cache-1");
+
+QueryCursor qry = cache.query(new ContinuousQuery<>()
 
 Review comment:
   qry is not used.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-02 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330538829
 
 

 ##
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
 ##
 @@ -2056,13 +2098,16 @@ else if (log.isDebugEnabled())
 private boolean autoUnsubscribe;
 
 /**
+ * @param nodeId Node id.
  * @param prjPred Projection predicate.
  * @param hnd Continuous routine handler.
  * @param bufSize Buffer size.
  * @param interval Interval.
  * @param autoUnsubscribe Automatic unsubscribe flag.
  */
-LocalRoutineInfo(@Nullable IgnitePredicate prjPred,
+LocalRoutineInfo(
+UUID nodeId,
 
 Review comment:
   I think there is no reason to make classes (interface) RoutineInfo
   , LocalRoutineInfo and RemoteRoutineInfo static.
   If LocalRoutineInfo isn't static, you can make the constructor like this:
   ```
   LocalRoutineInfo(
   @Nullable IgnitePredicate prjPred,
   GridContinuousHandler hnd,
   int bufSize,
   long interval,
   boolean autoUnsubscribe)
   {
   assert hnd != null;
   assert bufSize > 0;
   assert interval >= 0;
   assert ctx != null;
   
   this.nodeId = ctx.localNodeId();
   this.prjPred = prjPred;
   this.hnd = hnd;
   this.bufSize = bufSize;
   this.interval = interval;
   this.autoUnsubscribe = autoUnsubscribe;
   }
   ```
   That approach is required fewer changes and less error-prone.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [ignite] dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous query system view.

2019-10-02 Thread GitBox
dgarus commented on a change in pull request #6923: IGNITE-12214: Continuous 
query system view.
URL: https://github.com/apache/ignite/pull/6923#discussion_r330550838
 
 

 ##
 File path: 
modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 ##
 @@ -461,6 +466,61 @@ public void testClientsConnections() throws Exception {
 }
 }
 
+/** */
+@Test
+public void testContinuousQuery() throws Exception {
+try(IgniteEx g0 = startGrid(0); IgniteEx g1 = startGrid(1)) {
+IgniteCache cache = g0.createCache("cache-1");
+
+QueryCursor qry = cache.query(new ContinuousQuery<>()
+.setInitialQuery(new ScanQuery<>())
+.setPageSize(100)
+.setTimeInterval(1000)
+.setLocalListener(evts -> {
+// No-op.
+})
+.setRemoteFilterFactory(() -> evt -> true)
+);
+
+for (int i=0; i<100; i++)
+cache.put(i, i);
+
+SystemView qrys = 
g0.context().systemView().view(CQ_SYS_VIEW);
+
+assertEquals(1, qrys.size());
+
+//Info on originating node.
+for (ContinuousQueryView cq : qrys) {
+assertEquals("cache-1", cq.cacheName());
+assertEquals(100, cq.bufferSize());
+assertEquals(1000, cq.interval());
+assertEquals(g0.localNode().id(), cq.nodeId());
+//Local listener not null on originating node.
+
assertTrue(cq.localListener().startsWith(getClass().getName()));
+assertTrue(cq.remoteFilter().startsWith(getClass().getName()));
+assertNull(cq.localTransformedListener());
+assertNull(cq.remoteTransformer());
+}
+
+qrys = g1.context().systemView().view(CQ_SYS_VIEW);
+
+assertEquals(1, qrys.size());
+
+//Info on remote node.
+for (ContinuousQueryView cq : qrys) {
+assertEquals("cache-1", cq.cacheName());
+assertEquals(100, cq.bufferSize());
+assertEquals(1000, cq.interval());
+assertEquals(g0.localNode().id(), cq.nodeId());
+//Local listener is null on remote nodes.
+assertNull(cq.localListener());
+assertTrue(cq.remoteFilter().startsWith(getClass().getName()));
+assertNull(cq.localTransformedListener());
+assertNull(cq.remoteTransformer());
+}
 
 Review comment:
   It looks like code duplication.


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:
us...@infra.apache.org


With regards,
Apache Git Services