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/06/20 06:00:18 UTC
[16/50] ignite git commit: ignite-gg-12288 fix
SnapshotUtilityTestWithDaemonInTopologyTest,
send compute activate from daemon node
ignite-gg-12288 fix SnapshotUtilityTestWithDaemonInTopologyTest, send compute activate from daemon node
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/01e5cfb3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/01e5cfb3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/01e5cfb3
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 01e5cfb31fb2c03b283123f0d110cf07ad5de9fe
Parents: d21e6a5
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Fri Jun 16 21:17:21 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Fri Jun 16 21:17:21 2017 +0300
----------------------------------------------------------------------
.../cluster/GridClusterStateProcessor.java | 62 ++++++++++++--------
1 file changed, 38 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/01e5cfb3/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index 00c9799..9bf0cfa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -289,6 +289,14 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
*
*/
public IgniteInternalFuture<?> changeGlobalState(final boolean activate) {
+ if (ctx.isDaemon()) {
+ GridFutureAdapter<Void> fut = new GridFutureAdapter<>();
+
+ sendCompute(activate, fut);
+
+ return fut;
+ }
+
if (cacheProc.transactions().tx() != null || sharedCtx.lockedTopologyVersion(null) != null)
throw new IgniteException("Failed to " + prettyStr(activate) + " cluster (must invoke the " +
"method outside of an active transaction).");
@@ -316,30 +324,8 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
"Failed to " + prettyStr(activate) + ", because snapshot operation in progress."));
}
- if (ctx.clientNode()) {
- AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
-
- IgniteCompute comp = ((ClusterGroupAdapter)ctx.cluster().get().forServers()).compute();
-
- if (log.isInfoEnabled())
- log.info("Sending " + prettyStr(activate) + " request from client node [id=" +
- ctx.localNodeId() + " topVer=" + topVer + " ]");
-
- IgniteFuture<Void> fut = comp.runAsync(new ClientChangeGlobalStateComputeRequest(activate));
-
- fut.listen(new CI1<IgniteFuture>() {
- @Override public void apply(IgniteFuture fut) {
- try {
- fut.get();
-
- cgsFut.onDone();
- }
- catch (Exception e) {
- cgsFut.onDone(e);
- }
- }
- });
- }
+ if (ctx.clientNode())
+ sendCompute(activate, cgsFut);
else {
try {
List<DynamicCacheChangeRequest> reqs = new ArrayList<>();
@@ -380,6 +366,34 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
}
/**
+ *
+ */
+ private void sendCompute(boolean activate, final GridFutureAdapter<Void> res) {
+ AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
+
+ IgniteCompute comp = ((ClusterGroupAdapter)ctx.cluster().get().forServers()).compute();
+
+ if (log.isInfoEnabled())
+ log.info("Sending " + prettyStr(activate) + " request from node [id=" +
+ ctx.localNodeId() + " topVer=" + topVer + " isClient=" + ctx.isDaemon() +
+ " isDaemon" + ctx.isDaemon() + "]");
+
+ IgniteFuture<Void> fut = comp.runAsync(new ClientChangeGlobalStateComputeRequest(activate));
+
+ fut.listen(new CI1<IgniteFuture>() {
+ @Override public void apply(IgniteFuture fut) {
+ try {
+ fut.get();
+
+ res.onDone();
+ }
+ catch (Exception e) {
+ res.onDone(e);
+ }
+ }
+ });
+ }
+ /**
* @param reqs Requests to print.
* @param active Active flag.
*/