IGNITE-1733
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/10cf673c Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/10cf673c Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/10cf673c Branch: refs/heads/ignite-1655 Commit: 10cf673ce288229d5ff346f95542e0b8d4a9fea0 Parents: 9527933 Author: Anton Vinogradov <[email protected]> Authored: Mon Oct 19 18:23:47 2015 +0300 Committer: Anton Vinogradov <[email protected]> Committed: Mon Oct 19 18:23:47 2015 +0300 ---------------------------------------------------------------------- .../misc/schedule/ComputeScheduleExample.java | 82 ++++++++++++++++++++ .../examples/misc/schedule/package-info.java | 22 ++++++ .../misc/schedule/ComputeScheduleExample.java | 68 ++++++++++++++++ .../java8/misc/schedule/package-info.java | 22 ++++++ .../misc/schedule/ComputeScheduleExample.java | 82 -------------------- .../examples/misc/schedule/package-info.java | 22 ------ .../misc/schedule/ComputeScheduleExample.java | 68 ---------------- .../java8/misc/schedule/package-info.java | 22 ------ 8 files changed, 194 insertions(+), 194 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/10cf673c/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java ---------------------------------------------------------------------- diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java b/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java new file mode 100644 index 0000000..f8d0660 --- /dev/null +++ b/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java @@ -0,0 +1,82 @@ +/* + * 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.misc.schedule; + +import java.util.concurrent.Callable; +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteException; +import org.apache.ignite.Ignition; +import org.apache.ignite.examples.ExampleNodeStartup; +import org.apache.ignite.lang.IgniteRunnable; +import org.apache.ignite.scheduler.SchedulerFuture; + +/** + * Demonstrates a cron-based {@link Runnable} execution scheduling. + * Test runnable object broadcasts a phrase to all cluster nodes every minute + * three times with initial scheduling delay equal to five seconds. + * <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 ComputeScheduleExample { + /** + * 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")) { + System.out.println(); + System.out.println("Compute schedule example started."); + + // Schedule output message every minute. + SchedulerFuture<?> fut = ignite.scheduler().scheduleLocal( + new Callable<Integer>() { + private int invocations; + + @Override public Integer call() { + invocations++; + + ignite.compute().broadcast( + new IgniteRunnable() { + @Override public void run() { + System.out.println(); + System.out.println("Howdy! :)"); + } + } + ); + + return invocations; + } + }, + "{5, 3} * * * * *" // Cron expression. + ); + + while (!fut.isDone()) + System.out.println(">>> Invocation #: " + fut.get()); + + System.out.println(); + System.out.println(">>> Schedule future is done and has been unscheduled."); + System.out.println(">>> Check all nodes for hello message output."); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/10cf673c/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/package-info.java ---------------------------------------------------------------------- diff --git a/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/package-info.java b/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/package-info.java new file mode 100644 index 0000000..6602a6e --- /dev/null +++ b/examples-lgpl/src/main/java/org/apache/ignite/examples/misc/schedule/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. --> + * Demonstrates usage of cron-based scheduler. + */ +package org.apache.ignite.examples.misc.schedule; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/10cf673c/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java ---------------------------------------------------------------------- diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java new file mode 100644 index 0000000..c250638 --- /dev/null +++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java @@ -0,0 +1,68 @@ +/* + * 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.java8.misc.schedule; + +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteException; +import org.apache.ignite.Ignition; +import org.apache.ignite.examples.ExampleNodeStartup; +import org.apache.ignite.scheduler.SchedulerFuture; + +/** + * Demonstrates a cron-based {@link Runnable} execution scheduling. + * Test runnable object broadcasts a phrase to all cluster nodes every minute + * three times with initial scheduling delay equal to five seconds. + * <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 ComputeScheduleExample { + /** + * 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")) { + System.out.println(); + System.out.println("Compute schedule example started."); + + // Schedule output message every minute. + SchedulerFuture<?> fut = ignite.scheduler().scheduleLocal(() -> + ignite.compute().broadcast(() -> { + System.out.println(); + System.out.println("Howdy! :)"); + + return "Howdy! :)"; + }), + "{5, 3} * * * * *" // Cron expression. + ); + + while (!fut.isDone()) + System.out.println(">>> Invocation result: " + fut.get()); + + System.out.println(); + System.out.println(">>> Schedule future is done and has been unscheduled."); + System.out.println(">>> Check all nodes for hello message output."); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/10cf673c/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java ---------------------------------------------------------------------- diff --git a/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java new file mode 100644 index 0000000..5855994 --- /dev/null +++ b/examples-lgpl/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java @@ -0,0 +1,22 @@ +/* + * 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. --> + * Demonstrates usage of cron-based scheduler. + */ +package org.apache.ignite.examples.java8.misc.schedule; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/10cf673c/examples/src/main/java/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java b/examples/src/main/java/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java deleted file mode 100644 index f8d0660..0000000 --- a/examples/src/main/java/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java +++ /dev/null @@ -1,82 +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.misc.schedule; - -import java.util.concurrent.Callable; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteException; -import org.apache.ignite.Ignition; -import org.apache.ignite.examples.ExampleNodeStartup; -import org.apache.ignite.lang.IgniteRunnable; -import org.apache.ignite.scheduler.SchedulerFuture; - -/** - * Demonstrates a cron-based {@link Runnable} execution scheduling. - * Test runnable object broadcasts a phrase to all cluster nodes every minute - * three times with initial scheduling delay equal to five seconds. - * <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 ComputeScheduleExample { - /** - * 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")) { - System.out.println(); - System.out.println("Compute schedule example started."); - - // Schedule output message every minute. - SchedulerFuture<?> fut = ignite.scheduler().scheduleLocal( - new Callable<Integer>() { - private int invocations; - - @Override public Integer call() { - invocations++; - - ignite.compute().broadcast( - new IgniteRunnable() { - @Override public void run() { - System.out.println(); - System.out.println("Howdy! :)"); - } - } - ); - - return invocations; - } - }, - "{5, 3} * * * * *" // Cron expression. - ); - - while (!fut.isDone()) - System.out.println(">>> Invocation #: " + fut.get()); - - System.out.println(); - System.out.println(">>> Schedule future is done and has been unscheduled."); - System.out.println(">>> Check all nodes for hello message output."); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/10cf673c/examples/src/main/java/org/apache/ignite/examples/misc/schedule/package-info.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/misc/schedule/package-info.java b/examples/src/main/java/org/apache/ignite/examples/misc/schedule/package-info.java deleted file mode 100644 index 6602a6e..0000000 --- a/examples/src/main/java/org/apache/ignite/examples/misc/schedule/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. --> - * Demonstrates usage of cron-based scheduler. - */ -package org.apache.ignite.examples.misc.schedule; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/10cf673c/examples/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java deleted file mode 100644 index c250638..0000000 --- a/examples/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/ComputeScheduleExample.java +++ /dev/null @@ -1,68 +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.java8.misc.schedule; - -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteException; -import org.apache.ignite.Ignition; -import org.apache.ignite.examples.ExampleNodeStartup; -import org.apache.ignite.scheduler.SchedulerFuture; - -/** - * Demonstrates a cron-based {@link Runnable} execution scheduling. - * Test runnable object broadcasts a phrase to all cluster nodes every minute - * three times with initial scheduling delay equal to five seconds. - * <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 ComputeScheduleExample { - /** - * 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")) { - System.out.println(); - System.out.println("Compute schedule example started."); - - // Schedule output message every minute. - SchedulerFuture<?> fut = ignite.scheduler().scheduleLocal(() -> - ignite.compute().broadcast(() -> { - System.out.println(); - System.out.println("Howdy! :)"); - - return "Howdy! :)"; - }), - "{5, 3} * * * * *" // Cron expression. - ); - - while (!fut.isDone()) - System.out.println(">>> Invocation result: " + fut.get()); - - System.out.println(); - System.out.println(">>> Schedule future is done and has been unscheduled."); - System.out.println(">>> Check all nodes for hello message output."); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/10cf673c/examples/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java b/examples/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/package-info.java deleted file mode 100644 index 5855994..0000000 --- a/examples/src/main/java8/org/apache/ignite/examples/java8/misc/schedule/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. --> - * Demonstrates usage of cron-based scheduler. - */ -package org.apache.ignite.examples.java8.misc.schedule; \ No newline at end of file
