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 2017/12/01 08:22:53 UTC
[4/9] ignite git commit: IGNITE-7071 Cache stop request batching -
Fixes #3098.
IGNITE-7071 Cache stop request batching - Fixes #3098.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3998fbb7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3998fbb7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3998fbb7
Branch: refs/heads/ignite-zk
Commit: 3998fbb778460501fabacb25a3b9b6505e62cd4d
Parents: c1cdc4f
Author: dpavlov <dp...@gridgain.com>
Authored: Thu Nov 30 16:16:51 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Nov 30 16:16:51 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 36 ++++++++++++++++----
1 file changed, 29 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3998fbb7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 569b40b..99ff4cb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -2775,15 +2775,35 @@ public class GridCacheProcessor extends GridProcessorAdapter {
List<DynamicCacheChangeRequest> reqs = new ArrayList<>(cacheNames.size());
for (String cacheName : cacheNames) {
- DynamicCacheChangeRequest req = DynamicCacheChangeRequest.stopRequest(ctx, cacheName, false, true);
+ reqs.add(createStopRequest(cacheName, restart, destroy));
+ }
- req.stop(true);
- req.destroy(destroy);
- req.restart(restart);
+ return dynamicChangeCaches(reqs);
+ }
- reqs.add(req);
- }
+ /**
+ * Prepares cache stop request.
+ * @param cacheName Cache names to destroy.
+ * @param restart Restart flag.
+ * @param destroy Cache data destroy flag. Setting to {@code true} will cause removing all cache data from store.
+ * @return Future that will be completed when cache is destroyed.
+ */
+ @NotNull public DynamicCacheChangeRequest createStopRequest(String cacheName, boolean restart, boolean destroy) {
+ DynamicCacheChangeRequest req = DynamicCacheChangeRequest.stopRequest(ctx, cacheName, false, true);
+ req.stop(true);
+ req.destroy(destroy);
+ req.restart(restart);
+
+ return req;
+ }
+
+ /**
+ * Starts cache stop request as cache change batch.
+ * @param reqs cache stop requests.
+ * @return compound future.
+ */
+ @NotNull public IgniteInternalFuture<?> dynamicChangeCaches(List<DynamicCacheChangeRequest> reqs) {
GridCompoundFuture<?, ?> compoundFut = new GridCompoundFuture<>();
for (DynamicCacheStartFuture fut : initiateCacheChanges(reqs))
@@ -3770,9 +3790,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
+ * Method checks that current thread does not have active transactions.
+ *
* @throws IgniteException If transaction exist.
*/
- private void checkEmptyTransactions() throws IgniteException {
+ public void checkEmptyTransactions() throws IgniteException {
if (transactions().tx() != null || sharedCtx.lockedTopologyVersion(null) != null)
throw new IgniteException("Cannot start/stop cache within lock or transaction.");
}