brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjcorb...@apache.org
Subject [01/10] incubator-brooklyn git commit: Tasks.parallel and sequential take iterable and list arguments respectively
Date Mon, 12 Jan 2015 17:21:40 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 7f766234d -> eeb681a5d


Tasks.parallel and sequential take iterable and list arguments respectively


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/3b403fd9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/3b403fd9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/3b403fd9

Branch: refs/heads/master
Commit: 3b403fd96d518a3e2fe0dd69a1f925303114091f
Parents: 5a73ff0
Author: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Authored: Fri Dec 12 18:27:16 2014 +0000
Committer: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Committed: Fri Jan 9 13:56:39 2015 +0000

----------------------------------------------------------------------
 core/src/main/java/brooklyn/util/task/Tasks.java | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3b403fd9/core/src/main/java/brooklyn/util/task/Tasks.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/util/task/Tasks.java b/core/src/main/java/brooklyn/util/task/Tasks.java
index fd33985..bce2887 100644
--- a/core/src/main/java/brooklyn/util/task/Tasks.java
+++ b/core/src/main/java/brooklyn/util/task/Tasks.java
@@ -18,6 +18,7 @@
  */
 package brooklyn.util.task;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.Callable;
@@ -182,13 +183,16 @@ public class Tasks {
             result[i] = tasks[i].asTask();
         return result;
     }
-    
+
     public static Task<List<?>> parallel(TaskAdaptable<?> ...tasks) {
         return parallelInternal("parallelised tasks", asTasks(tasks));
     }
     public static Task<List<?>> parallel(String name, TaskAdaptable<?>
...tasks) {
         return parallelInternal(name, asTasks(tasks));
     }
+    public static Task<List<?>> parallel(Iterable<? extends TaskAdaptable<?>>
tasks) {
+        return parallel(asTasks(Iterables.toArray(tasks, TaskAdaptable.class)));
+    }
     public static Task<List<?>> parallel(String name, Iterable<? extends TaskAdaptable<?>>
tasks) {
         return parallelInternal(name, asTasks(Iterables.toArray(tasks, TaskAdaptable.class)));
     }
@@ -208,6 +212,12 @@ public class Tasks {
     public static TaskFactory<?> sequential(String name, TaskFactory<?> ...taskFactories)
{
         return sequentialInternal(name, taskFactories);
     }
+    public static Task<List<?>> sequential(List<? extends TaskAdaptable<?>>
tasks) {
+        return sequential(asTasks(Iterables.toArray(tasks, TaskAdaptable.class)));
+    }
+    public static Task<List<?>> sequential(String name, List<? extends TaskAdaptable<?>>
tasks) {
+        return sequential(name, asTasks(Iterables.toArray(tasks, TaskAdaptable.class)));
+    }
     private static Task<List<?>> sequentialInternal(String name, Task<?>[]
tasks) {
         return Tasks.<List<?>>builder().name(name).parallel(false).add(tasks).build();
     }


Mime
View raw message