brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjcorb...@apache.org
Subject [1/3] brooklyn-server git commit: Readability
Date Thu, 01 Dec 2016 12:01:03 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 23f9a715c -> d1ef42a1e


Readability


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/5b9f8965
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/5b9f8965
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/5b9f8965

Branch: refs/heads/master
Commit: 5b9f89653ee5979665bff445d38750e1d0f234ae
Parents: a569463
Author: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Authored: Wed Nov 16 15:36:45 2016 +0000
Committer: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Committed: Fri Nov 18 15:08:31 2016 +0000

----------------------------------------------------------------------
 .../brooklyn/core/effector/Effectors.java       |  8 ++++--
 .../entity/group/DynamicClusterImpl.java        |  3 ++-
 .../brooklyn/util/core/task/ParallelTask.java   | 27 +++++++++++++++-----
 .../brooklyn/util/core/task/SequentialTask.java | 27 ++++++++++++++------
 4 files changed, 47 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5b9f8965/core/src/main/java/org/apache/brooklyn/core/effector/Effectors.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/effector/Effectors.java b/core/src/main/java/org/apache/brooklyn/core/effector/Effectors.java
index 9b10d1d..6240240 100644
--- a/core/src/main/java/org/apache/brooklyn/core/effector/Effectors.java
+++ b/core/src/main/java/org/apache/brooklyn/core/effector/Effectors.java
@@ -183,14 +183,18 @@ public class Effectors {
     public static TaskAdaptable<List<?>> invocationParallel(Effector<?>
eff, Map<?,?> params, Iterable<? extends Entity> entities) {
         List<TaskAdaptable<?>> tasks = new ArrayList<TaskAdaptable<?>>();
         for (Entity e: entities) tasks.add(invocation(e, eff, params));
-        return Tasks.parallel("invoking "+eff+" on "+tasks.size()+" node"+(Strings.s(tasks.size())),
tasks.toArray(new TaskAdaptable[tasks.size()]));
+        return Tasks.parallel(
+                "invoking " + eff + " on " + tasks.size() + " node" + (Strings.s(tasks.size())),
+                tasks.toArray(new TaskAdaptable[tasks.size()]));
     }
 
     /** as {@link #invocationParallel(Effector, Map, Iterable)} but executing sequentially
*/
     public static TaskAdaptable<List<?>> invocationSequential(Effector<?>
eff, Map<?,?> params, Iterable<? extends Entity> entities) {
         List<TaskAdaptable<?>> tasks = new ArrayList<TaskAdaptable<?>>();
         for (Entity e: entities) tasks.add(invocation(e, eff, params));
-        return Tasks.sequential("invoking "+eff+" on "+tasks.size()+" node"+(Strings.s(tasks.size())),
tasks.toArray(new TaskAdaptable[tasks.size()]));
+        return Tasks.sequential(
+                "invoking " + eff + " on " + tasks.size() + " node" + (Strings.s(tasks.size())),
+                tasks.toArray(new TaskAdaptable[tasks.size()]));
     }
 
     /** returns an unsubmitted task which will invoke the given effector on the given entities

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5b9f8965/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java b/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java
index eedefa7..8725b12 100644
--- a/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java
+++ b/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java
@@ -787,7 +787,8 @@ public class DynamicClusterImpl extends AbstractGroupImpl implements DynamicClus
         Collection<Entity> removedEntities = pickAndRemoveMembers(delta * -1);
 
         // FIXME symmetry in order of added as child, managed, started, and added to group
-        Task<?> invoke = Entities.invokeEffector(this, (Iterable<Entity>)(Iterable<?>)Iterables.filter(removedEntities,
Startable.class), Startable.STOP, Collections.<String,Object>emptyMap());
+        final Iterable<Entity> removedStartables = (Iterable<Entity>) (Iterable<?>)
Iterables.filter(removedEntities, Startable.class);
+        Task<?> invoke = Entities.invokeEffector(this, removedStartables, Startable.STOP,
Collections.<String,Object>emptyMap());
         try {
             invoke.get();
             return removedEntities;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5b9f8965/core/src/main/java/org/apache/brooklyn/util/core/task/ParallelTask.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/ParallelTask.java b/core/src/main/java/org/apache/brooklyn/util/core/task/ParallelTask.java
index 82ec564..a2425f7 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/task/ParallelTask.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/task/ParallelTask.java
@@ -38,13 +38,26 @@ import com.google.common.collect.Lists;
  * order they were passed as arguments.
  */
 public class ParallelTask<T> extends CompoundTask<T> {
-    public ParallelTask(Object... tasks) { super(tasks); }
-    
-    public ParallelTask(Map<String,?> flags, Collection<? extends Object> tasks)
{ super(flags, tasks); }
-    public ParallelTask(Collection<? extends Object> tasks) { super(tasks); }
-    
-    public ParallelTask(Map<String,?> flags, Iterable<? extends Object> tasks)
{ super(flags, ImmutableList.copyOf(tasks)); }
-    public ParallelTask(Iterable<? extends Object> tasks) { super(ImmutableList.copyOf(tasks));
}
+
+    public ParallelTask(Object... tasks) {
+        super(tasks);
+    }
+
+    public ParallelTask(Map<String, ?> flags, Collection<?> tasks) {
+        super(flags, tasks);
+    }
+
+    public ParallelTask(Collection<?> tasks) {
+        super(tasks);
+    }
+
+    public ParallelTask(Map<String, ?> flags, Iterable<?> tasks) {
+        super(flags, ImmutableList.copyOf(tasks));
+    }
+
+    public ParallelTask(Iterable<?> tasks) {
+        super(ImmutableList.copyOf(tasks));
+    }
 
     @Override
     protected List<T> runJobs() throws InterruptedException, ExecutionException {

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5b9f8965/core/src/main/java/org/apache/brooklyn/util/core/task/SequentialTask.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/SequentialTask.java b/core/src/main/java/org/apache/brooklyn/util/core/task/SequentialTask.java
index 9bd40af..1a9fbac 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/task/SequentialTask.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/task/SequentialTask.java
@@ -28,19 +28,30 @@ import org.apache.brooklyn.api.mgmt.Task;
 
 import com.google.common.collect.ImmutableList;
 
-
 /** runs tasks in order, waiting for one to finish before starting the next; return value
here is TBD;
  * (currently is all the return values of individual tasks, but we
  * might want some pipeline support and eventually only to return final value...) */
 public class SequentialTask<T> extends CompoundTask<T> {
 
-    public SequentialTask(Object... tasks) { super(tasks); }
-    
-    public SequentialTask(Map<String,?> flags, Collection<? extends Object> tasks)
{ super(flags, tasks); }
-    public SequentialTask(Collection<? extends Object> tasks) { super(tasks); }
-    
-    public SequentialTask(Map<String,?> flags, Iterable<? extends Object> tasks)
{ super(flags, ImmutableList.copyOf(tasks)); }
-    public SequentialTask(Iterable<? extends Object> tasks) { super(ImmutableList.copyOf(tasks));
}
+    public SequentialTask(Object... tasks) {
+        super(tasks);
+    }
+
+    public SequentialTask(Map<String, ?> flags, Collection<?> tasks) {
+        super(flags, tasks);
+    }
+
+    public SequentialTask(Collection<?> tasks) {
+        super(tasks);
+    }
+
+    public SequentialTask(Map<String, ?> flags, Iterable<?> tasks) {
+        super(flags, ImmutableList.copyOf(tasks));
+    }
+
+    public SequentialTask(Iterable<?> tasks) {
+        super(ImmutableList.copyOf(tasks));
+    }
     
     protected List<T> runJobs() throws InterruptedException, ExecutionException {
         setBlockingDetails("Executing "+


Mime
View raw message