Github user aledsage commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/816#discussion_r140606634
--- 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've never liked our `ScheduledTask` api. Long term, I'd prefer it to feel
more like `java.util.concurrent.ScheduledExecutorService` (rather than it being
based on the type of task passed in).
I've not reviewed this properly yet, but I'm guessing the
`ScheduledTask.Builder` will make it a bit nicer to work with the existing
`ScheduledTask` - so that's a good idea for an incremental improvement.
However, I'd eventually like a complete re-write of this area so we can have
some kind of executionManager.schedule() method.
---