ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ivasilin...@apache.org
Subject incubator-ignite git commit: #ignite-1161: replace scheduler with ignite scheduler.
Date Wed, 29 Jul 2015 07:14:08 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-1161 a9eb9da03 -> 5876e0af7


#ignite-1161: replace scheduler with  ignite scheduler.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5876e0af
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5876e0af
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5876e0af

Branch: refs/heads/ignite-1161
Commit: 5876e0af7b95223559bb0f4b16a0b7bef61f1092
Parents: a9eb9da
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Wed Jul 29 10:13:54 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Wed Jul 29 10:13:54 2015 +0300

----------------------------------------------------------------------
 .../handlers/query/QueryCommandHandler.java     | 25 ++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5876e0af/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
index ffac32c..f845456 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
@@ -177,7 +177,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter
{
                 }
             }
             catch (Exception e) {
-                qryCurs.remove(qryId);
+                removeQueryCursor(qryId);
 
                 return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage());
             }
@@ -233,7 +233,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter
{
                 return new GridRestResponse(true);
             }
             catch (Exception e) {
-                qryCurs.remove(req.queryId());
+                removeQueryCursor(req.queryId());
 
                 return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage());
             }
@@ -274,7 +274,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter
{
                 }
             }
             catch (Exception e) {
-                qryCurs.remove(req.queryId());
+                removeQueryCursor(req.queryId());
 
                 return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage());
             }
@@ -302,8 +302,25 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter
{
         res.setQueryId(qryId);
 
         if (!cur.hasNext())
-            qryCurs.remove(qryId);
+            removeQueryCursor(qryId);
 
         return res;
     }
+
+    /**
+     * Removes query cursor.
+     *
+     * @param qryId Query id.
+     */
+    private static void removeQueryCursor(Long qryId) {
+        GridTuple3<QueryCursor, Iterator, Long> t = qryCurs.get(qryId);
+
+        if (t != null) {
+            synchronized (t) {
+                t.get1().close();
+
+                qryCurs.remove(qryId);
+            }
+        }
+    }
 }


Mime
View raw message