|
24 | 24 | import java.util.Calendar;
|
25 | 25 | import java.util.Date;
|
26 | 26 | import java.util.Map;
|
27 |
| -import java.util.concurrent.Callable; |
28 | 27 | import java.util.concurrent.Executors;
|
29 | 28 | import java.util.concurrent.ScheduledExecutorService;
|
30 | 29 |
|
31 | 30 | import org.apache.brooklyn.api.effector.Effector;
|
32 | 31 | import org.apache.brooklyn.api.entity.EntityLocal;
|
33 |
| -import org.apache.brooklyn.api.mgmt.Task; |
34 | 32 | import org.apache.brooklyn.config.ConfigKey;
|
35 | 33 | import org.apache.brooklyn.core.config.ConfigKeys;
|
36 | 34 | import org.apache.brooklyn.core.entity.EntityInitializers;
|
|
50 | 48 | import com.google.common.base.Predicates;
|
51 | 49 | import com.google.common.collect.ImmutableMap;
|
52 | 50 | import com.google.common.collect.Iterables;
|
53 |
| -import com.google.common.collect.Maps; |
54 | 51 | import com.google.common.reflect.TypeToken;
|
55 | 52 |
|
56 | 53 | @Beta
|
@@ -146,22 +143,14 @@ protected Duration getWaitUntil(String time) {
|
146 | 143 | public void run() {
|
147 | 144 | synchronized (mutex) {
|
148 | 145 | try {
|
149 |
| - final ConfigBag bag = ResolvingConfigBag.newInstanceExtending(getManagementContext(), config().getBag()); |
150 |
| - final Map<String, Object> args = EntityInitializers.resolve(bag, EFFECTOR_ARGUMENTS); |
| 146 | + ConfigBag bag = ResolvingConfigBag.newInstanceExtending(getManagementContext(), config().getBag()); |
| 147 | + Map<String, Object> args = EntityInitializers.resolve(bag, EFFECTOR_ARGUMENTS); |
151 | 148 | LOG.debug("{}: Resolving arguments for {}: {}", new Object[] { this, effector.getName(), Iterables.toString(args.keySet()) });
|
152 |
| - bag.putAll(args); |
153 |
| - Task<Map<String, Object>> resolve = Tasks.create("resolveArguments", new Callable<Map<String, Object>>() { |
154 |
| - @Override |
155 |
| - public Map<String, Object> call() { |
156 |
| - Map<String, Object> resolved = Maps.newLinkedHashMap(); |
157 |
| - for (String key : args.keySet()) { |
158 |
| - resolved.put(key, bag.getStringKey(key)); |
159 |
| - } |
160 |
| - return resolved; |
161 |
| - } |
162 |
| - }); |
163 |
| - getManagementContext().getExecutionContext(entity).submit(resolve); |
164 |
| - Map<String, Object> resolved = resolve.getUnchecked(); |
| 149 | + Map<String, Object> resolved = (Map) Tasks.resolving(args, Object.class) |
| 150 | + .deep(true) |
| 151 | + .context(entity) |
| 152 | + .get(); |
| 153 | + |
165 | 154 | LOG.debug("{}: Invoking effector on {}, {}({})", new Object[] { this, entity, effector.getName(), resolved });
|
166 | 155 | Object result = entity.invoke(effector, resolved).getUnchecked();
|
167 | 156 | LOG.debug("{}: Effector {} returned {}", new Object[] { this, effector.getName(), result });
|
|
0 commit comments