Github user aledsage commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/853#discussion_r142932583
--- Diff:
core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java
---
@@ -102,8 +102,15 @@
* </pre>
* <p>
* Note that these methods return one-time tasks. The DslComponent methods
return long-lasting pointers
- * and should now normally be used instead.
+ * and should now normally be used instead. If using these methods that
return {@link Task} instances
+ * you should either ensure it is submitted or that validation and any
other attempts to
+ * {@link ExecutionContext#getImmediately(TaskAdaptable)} on this task is
blocked;
+ * it is all to easy otherwise for an innocuous immediate-get to render
this task interrupted
*/
+// possibly even the REST API just looking at config could cancel?
+// TODO should we deprecate these and provide variants that return
TaskFactory instances?
+// maybe even ones that are nicely persistable? i (alex) think so, 2017-10.
+// see
https://github.com/apache/brooklyn-server/pull/816#issuecomment-333858098
public class DependentConfiguration {
--- End diff --
In `DslComponent`, it calls to things like
`DependentConfiguration.attributeWhenReady(targetEntity,
(AttributeSensor<?>)targetSensor)` for its implementation of `newTask`.
I think we want to keep this code, but for people to not use it directly! I
presume the way to do that (sticking to our deprecation policy) would be to
create a new internal class (e.g. that delegates to it), and to deprecate this
class.
I've always wondered about our `DslComponent` class. It feels like there's
a big chunk of code in `brooklyn-camp` that could live in `core`. Things like
the `DslComponent.AttributeWhenReady` class no longer has anything to do with
the original yaml. We could move that to core (preserving backwards
compatibility with persisted state obviously).
I don't think there's a need for any other new code that returns
`TaskFactory` instances - we should re-use the existing `DslComponent` code as
much as possible.
---