Merge remote-tracking branch 'remotes/origin/master' into ignite-1161
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0f7816de Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0f7816de Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0f7816de Branch: refs/heads/ignite-1161 Commit: 0f7816def8a318e3b4c9b3c303d9d5f2f138204f Parents: c92efc3 aec9764 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Fri Jul 31 14:55:48 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Fri Jul 31 14:55:48 2015 +0300 ---------------------------------------------------------------------- .../JettyRestProcessorAbstractSelfTest.java | 14 +-- .../GridDhtPartitionsExchangeFuture.java | 20 ++-- .../datastreamer/DataStreamerImpl.java | 22 ++++ .../datastreamer/DataStreamerUpdateJob.java | 20 +++- .../handlers/query/QueryCommandHandler.java | 6 +- .../communication/tcp/TcpCommunicationSpi.java | 41 ++++++- .../ignite/spi/discovery/tcp/ServerImpl.java | 45 ++++---- .../spi/discovery/tcp/TcpDiscoverySpi.java | 2 +- ...cheDhtLocalPartitionAfterRemoveSelfTest.java | 107 +++++++++++++++++++ .../tcp/TcpDiscoveryMultiThreadedTest.java | 8 +- .../http/jetty/GridJettyRestHandler.java | 12 +-- 11 files changed, 241 insertions(+), 56 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7816de/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7816de/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java index a6a4c5c,1712dd4..bb19f2a --- 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 @@@ -152,9 -138,9 +152,9 @@@ public class QueryCommandHandler extend if (cache == null) return new GridRestResponse(GridRestResponse.STATUS_FAILED, - "No cache with name [cacheName=" + req.cacheName() + "]"); + "Failed to find cache with name: " + req.cacheName()); - QueryCursor qryCur = cache.query(qry); + final QueryCursor qryCur = cache.query(qry); Iterator cur = qryCur.iterator(); @@@ -212,19 -200,15 +212,19 @@@ /** {@inheritDoc} */ @Override public GridRestResponse call() throws Exception { try { - QueryCursor cur = qryCurs.get(req.queryId()).get1(); + GridTuple3<QueryCursor, Iterator, Long> val = qryCurs.get(req.queryId()); - if (cur == null) + if (val == null) return new GridRestResponse(GridRestResponse.STATUS_FAILED, - "Cannot find query [qryId=" + req.queryId() + "]"); + "Failed to find query with ID: " + req.queryId()); - cur.close(); + synchronized (val) { + QueryCursor cur = val.get1(); + + cur.close(); - qryCurs.remove(req.queryId()); + qryCurs.remove(req.queryId()); + } return new GridRestResponse(true); } @@@ -253,24 -243,18 +253,24 @@@ /** {@inheritDoc} */ @Override public GridRestResponse call() throws Exception { try { - Iterator cur = qryCurs.get(req.queryId()).get2(); + GridTuple3<QueryCursor, Iterator, Long> t = qryCurs.get(req.queryId()); - if (cur == null) + if (t == null) return new GridRestResponse(GridRestResponse.STATUS_FAILED, - "Cannot find query [qryId=" + req.queryId() + "]"); + "Failed to find query with ID: " + req.queryId()); - CacheQueryResult res = createQueryResult(qryCurs, cur, req, req.queryId()); + synchronized (t) { + t.set3(System.currentTimeMillis()); + + Iterator cur = t.get2(); - return new GridRestResponse(res); + CacheQueryResult res = createQueryResult(cur, req, req.queryId()); + + return new GridRestResponse(res); + } } catch (Exception e) { - qryCurs.remove(req.queryId()); + removeQueryCursor(req.queryId()); return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage()); }