Github user ahgittin commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/816#discussion_r140611314
--- Diff:
core/src/main/java/org/apache/brooklyn/util/core/task/ScheduledTask.java ---
@@ -117,6 +121,44 @@ public ScheduledTask(Map<?,?> flags, Callable<Task<?>>
taskFactory) {
cancelOnException = cancelFlag == null ||
Boolean.TRUE.equals(cancelFlag);
}
+ public static Builder builder(Callable<Task<?>> val) {
+ return new Builder(val);
+ }
+
+ public static class Builder {
--- End diff --
I can see that. Logically I think the cleanest for both scheduled and
one-off tasks would be to separate the submitted job, the execution parameters
and metadata (schedule, same thread, name, tags, etc), and the result handle.
But not sure how nice that would be to work with. There are times when I want
them conflated a la submit(task) then task.getResult but other times I want
handle=submit(name, job).
But yes all I did here was make a builder rather than a messy constructor.
---