Github user aledsage commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/853#discussion_r142930161
--- Diff: api/src/main/java/org/apache/brooklyn/api/objs/Configurable.java
---
@@ -85,19 +88,39 @@
<T> T set(HasConfigKey<T> key, T val);
/**
- * Sets the config to the value returned by the task.
+ * Sets the config to return the value returned by the task this
generates,
+ * on demand when invoked.
+ * <p>
+ * Returns immediately without blocking; subsequent calls to
{@link #getConfig(ConfigKey)}
+ * will create and execute an instance of the task, blocking
unless otherwise configured.
*
+ * @see {@link #setConfig(ConfigKey, Object)}
+ */
+ <T> T set(ConfigKey<T> key, TaskFactory<? extends
TaskAdaptable<T>> val);
+
+ /**
+ * Sets the config to the value returned by the task.
+ * <p>
+ * It is recommended to use {@link #set(ConfigKey, TaskFactory)}
instead so that calls to validate
+ * items via {@link ExecutionContext#getImmediately(Object)} do
not interrupt and wreck the task set here.
+ * <p>
* Returns immediately without blocking; subsequent calls to
{@link #getConfig(ConfigKey)}
* will execute the task, and block until the task completes.
*
* @see {@link #setConfig(ConfigKey, Object)}
*/
- <T> T set(ConfigKey<T> key, Task<T> val);
+ <T> T set(ConfigKey<T> key, TaskAdaptable<T> val);
--- End diff --
Add `TODO Deprecate` here as well.
Some power-users might implement `ConfigurationSupport`, which this will
impact, but that's fine: it's marked `@Beta`.
---