Github user aledsage commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/816#discussion_r141918771
--- Diff:
core/src/main/java/org/apache/brooklyn/util/core/task/BasicTask.java ---
@@ -906,18 +908,14 @@ public void setSubmitTimeUtc(long val) {
submitTimeUtc = val;
}
- private static <T> Task<T> newGoneTaskFor(Task<?> task) {
- Task<T> t =
Tasks.<T>builder().dynamic(false).displayName(task.getDisplayName())
- .description("Details of the original task "+task+" have been
forgotten.")
- .body(Callables.returning((T)null)).build();
- ((BasicTask<T>)t).ignoreIfNotRun();
- return t;
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void setSubmittedByTask(Task<?> task) {
- submittedByTask = Maybe.softThen((Task)task,
(Maybe)Maybe.of(BasicTask.newGoneTaskFor(task)));
+ setSubmittedByTask(Maybe.of(task), task==null ? null :
task.getId());
--- End diff --
What does a call to `setSubmittedByTask(null)` mean? I'd have assumed it's
either a programming error or if we want to support it then it means there is
no task - i.e. use `Maybe.fromNullable(task)`. Otherwise
`getSubmittedByTaskId()` would throw an exception "Task was set up with a
submitted task but no task ID".
---