You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/01/15 09:01:12 UTC
[58/60] incubator-ignite git commit: # Fixed query with portables.
# Fixed query with portables.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e4c2bc46
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e4c2bc46
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e4c2bc46
Branch: refs/heads/ignite-32
Commit: e4c2bc4662f69fdb05d8d99779ebdface45c7c60
Parents: 0d5ea99
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jan 15 14:53:04 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jan 15 14:53:04 2015 +0700
----------------------------------------------------------------------
.../grid/kernal/visor/query/VisorQueryTask.java | 53 ++++++++++++--------
1 file changed, 32 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4c2bc46/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryTask.java b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryTask.java
index 1efc054..225eb79 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryTask.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryTask.java
@@ -129,6 +129,11 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryTask.VisorQueryAr
/** Flag indicating that this furure was read from last check. */
private Boolean accessed;
+ /**
+ * @param fut Future.
+ * @param next Next value.
+ * @param accessed {@code true} if query was accessed before remove timeout expired.
+ */
public VisorFutureResultSetHolder(GridCacheQueryFuture<R> fut, R next, Boolean accessed) {
this.fut = fut;
this.next = next;
@@ -188,15 +193,19 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryTask.VisorQueryAr
try {
Boolean scan = arg.queryTxt().toUpperCase().startsWith("SCAN");
- String qryId = (scan ? VisorQueryUtils.SCAN_QRY_NAME : VisorQueryUtils.SQL_QRY_NAME) + "-" + UUID.randomUUID();
+ String qryId = (scan ? VisorQueryUtils.SCAN_QRY_NAME : VisorQueryUtils.SQL_QRY_NAME) + "-" +
+ UUID.randomUUID();
GridCache<Object, Object> c = g.cachex(arg.cacheName());
if (c == null)
- return new IgniteBiTuple<>(new IgniteCheckedException("Cache not found: " + escapeName(arg.cacheName())), null);
+ return new IgniteBiTuple<>(new IgniteCheckedException("Cache not found: " +
+ escapeName(arg.cacheName())), null);
+
+ GridCacheProjection<Object, Object> cp = c.keepPortable();
if (scan) {
- GridCacheQueryFuture<Map.Entry<Object, Object>> fut = c.queries().createScanQuery(null)
+ GridCacheQueryFuture<Map.Entry<Object, Object>> fut = cp.queries().createScanQuery(null)
.pageSize(arg.pageSize())
.projection(g.forNodeIds(arg.proj()))
.execute();
@@ -221,7 +230,7 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryTask.VisorQueryAr
VisorQueryUtils.SCAN_COL_NAMES, rows.get1(), next != null, duration));
}
else {
- GridCacheQueryFuture<List<?>> fut = ((GridCacheQueriesEx<?, ?>)c.queries())
+ GridCacheQueryFuture<List<?>> fut = ((GridCacheQueriesEx<?, ?>)cp.queries())
.createSqlFieldsQuery(arg.queryTxt(), true)
.pageSize(arg.pageSize())
.projection(g.forNodeIds(arg.proj()))
@@ -245,7 +254,8 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryTask.VisorQueryAr
long start = U.currentTimeMillis();
- IgniteBiTuple<List<Object[]>, List<?>> rows = VisorQueryUtils.fetchSqlQueryRows(fut, firstRow, arg.pageSize());
+ IgniteBiTuple<List<Object[]>, List<?>> rows =
+ VisorQueryUtils.fetchSqlQueryRows(fut, firstRow, arg.pageSize());
long fetchDuration = U.currentTimeMillis() - start;
@@ -271,24 +281,25 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryTask.VisorQueryAr
* @param id Uniq query result id.
*/
private void scheduleResultSetHolderRemoval(final String id) {
- ((GridKernal)g).context().timeout().addTimeoutObject(new GridTimeoutObjectAdapter(VisorQueryUtils.RMV_DELAY) {
- @Override public void onTimeout() {
- ClusterNodeLocalMap<String, VisorFutureResultSetHolder> storage = g.nodeLocalMap();
-
- VisorFutureResultSetHolder<?> t = storage.get(id);
-
- if (t != null) {
- // If future was accessed since last scheduling, set access flag to false and reschedule.
- if (t.accessed()) {
- t.accessed(false);
-
- scheduleResultSetHolderRemoval(id);
+ ((GridKernal)g).context().timeout()
+ .addTimeoutObject(new GridTimeoutObjectAdapter(VisorQueryUtils.RMV_DELAY) {
+ @Override public void onTimeout() {
+ ClusterNodeLocalMap<String, VisorFutureResultSetHolder> storage = g.nodeLocalMap();
+
+ VisorFutureResultSetHolder<?> t = storage.get(id);
+
+ if (t != null) {
+ // If future was accessed since last scheduling, set access flag to false and reschedule.
+ if (t.accessed()) {
+ t.accessed(false);
+
+ scheduleResultSetHolderRemoval(id);
+ }
+ else
+ storage.remove(id); // Remove stored future otherwise.
}
- else
- storage.remove(id); // Remove stored future otherwise.
}
- }
- });
+ });
}
/** {@inheritDoc} */