Repository: ignite Updated Branches: refs/heads/ignite-2.4 76e169fce -> 47d05b2eb
IGNITE-7534: Removed ClusterGroupExample duplicate. Fixes #3446. Signed-off-by: Valentin Kulichenko <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/47d05b2e Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/47d05b2e Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/47d05b2e Branch: refs/heads/ignite-2.4 Commit: 47d05b2eb1ecfef225b4f3460b0eca5122f96b15 Parents: 76e169f Author: Ivanov Petr <[email protected]> Authored: Mon Jan 29 12:17:41 2018 -0800 Committer: Pavel Tupitsyn <[email protected]> Committed: Tue Jan 30 12:14:44 2018 +0300 ---------------------------------------------------------------------- .../cluster/ClusterGroupExample.java | 99 -------------------- .../computegrid/cluster/package-info.java | 22 ----- 2 files changed, 121 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/47d05b2e/examples/src/main/java/org/apache/ignite/examples/computegrid/cluster/ClusterGroupExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/computegrid/cluster/ClusterGroupExample.java b/examples/src/main/java/org/apache/ignite/examples/computegrid/cluster/ClusterGroupExample.java deleted file mode 100644 index d2b75df..0000000 --- a/examples/src/main/java/org/apache/ignite/examples/computegrid/cluster/ClusterGroupExample.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.examples.computegrid.cluster; - -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCluster; -import org.apache.ignite.IgniteException; -import org.apache.ignite.Ignition; -import org.apache.ignite.cluster.ClusterGroup; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.examples.ExampleNodeStartup; -import org.apache.ignite.examples.ExamplesUtils; -import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.lang.IgniteRunnable; - -/** - * Demonstrates new functional APIs. - * <p> - * Remote nodes should always be started with special configuration file which - * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}. - * <p> - * Alternatively you can run {@link ExampleNodeStartup} in another JVM which will start node - * with {@code examples/config/example-ignite.xml} configuration. - */ -public class ClusterGroupExample { - /** - * Executes example. - * - * @param args Command line arguments, none required. - * @throws IgniteException If example execution failed. - */ - public static void main(String[] args) throws IgniteException { - try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { - if (!ExamplesUtils.checkMinTopologySize(ignite.cluster(), 2)) - return; - - System.out.println(); - System.out.println("Compute example started."); - - IgniteCluster cluster = ignite.cluster(); - - // Say hello to all nodes in the cluster, including local node. - sayHello(ignite, cluster); - - // Say hello to all remote nodes. - sayHello(ignite, cluster.forRemotes()); - - // Pick random node out of remote nodes. - ClusterGroup randomNode = cluster.forRemotes().forRandom(); - - // Say hello to a random node. - sayHello(ignite, randomNode); - - // Say hello to all nodes residing on the same host with random node. - sayHello(ignite, cluster.forHost(randomNode.node())); - - // Say hello to all nodes that have current CPU load less than 50%. - sayHello(ignite, cluster.forPredicate(new IgnitePredicate<ClusterNode>() { - @Override public boolean apply(ClusterNode n) { - return n.metrics().getCurrentCpuLoad() < 0.5; - } - })); - } - } - - /** - * Print 'Hello' message on remote nodes. - * - * @param ignite Ignite. - * @param grp Cluster group. - * @throws IgniteException If failed. - */ - private static void sayHello(Ignite ignite, final ClusterGroup grp) throws IgniteException { - // Print out hello message on all cluster nodes. - ignite.compute(grp).broadcast( - new IgniteRunnable() { - @Override public void run() { - // Print ID of remote node on remote node. - System.out.println(">>> Hello Node: " + grp.ignite().cluster().localNode().id()); - } - } - ); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/47d05b2e/examples/src/main/java/org/apache/ignite/examples/computegrid/cluster/package-info.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/computegrid/cluster/package-info.java b/examples/src/main/java/org/apache/ignite/examples/computegrid/cluster/package-info.java deleted file mode 100644 index cf144d1..0000000 --- a/examples/src/main/java/org/apache/ignite/examples/computegrid/cluster/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * <!-- Package description. --> - * Cluster group example. - */ -package org.apache.ignite.examples.computegrid.cluster; \ No newline at end of file
