You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2017/03/20 15:57:26 UTC
[01/11] brooklyn-server git commit: use new maybe assertions
Repository: brooklyn-server
Updated Branches:
refs/heads/master a0f884059 -> afe274fcb
use new maybe assertions
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/0d77dbc1
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/0d77dbc1
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/0d77dbc1
Branch: refs/heads/master
Commit: 0d77dbc17235c9bfb833467fcb158ee3a69843eb
Parents: 2e6f11f
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Feb 20 14:39:06 2017 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Feb 20 14:40:22 2017 +0000
----------------------------------------------------------------------
.../org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0d77dbc1/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
index 1686f55..e1f1708 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
@@ -372,10 +372,10 @@ public class ConfigYamlTest extends AbstractYamlTest {
final TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
// Attribute not yet set; non-blocking will return promptly without the value
- assertTrue(entity.config().getNonBlocking(TestEntity.CONF_NAME).isAbsent());
- assertTrue(entity.config().getNonBlocking(TestEntity.CONF_MAP_THING).isAbsent());
- assertTrue(entity.config().getNonBlocking(TestEntity.CONF_LIST_THING).isAbsent());
- assertTrue(entity.config().getNonBlocking(TestEntity.CONF_SET_THING).isAbsent());
+ Asserts.assertNotPresent(entity.config().getNonBlocking(TestEntity.CONF_NAME));
+ Asserts.assertNotPresent(entity.config().getNonBlocking(TestEntity.CONF_MAP_THING));
+ Asserts.assertNotPresent(entity.config().getNonBlocking(TestEntity.CONF_LIST_THING));
+ Asserts.assertNotPresent(entity.config().getNonBlocking(TestEntity.CONF_SET_THING));
// Now set the attribute: get will return once that has happened
executor.submit(new Callable<Object>() {
[02/11] brooklyn-server git commit: Switch more of the "immediate" /
"non-blocking" calls to be truly non-blocking.
Posted by he...@apache.org.
Switch more of the "immediate" / "non-blocking" calls to be truly non-blocking.
Also updates tests. Mainly uses ImmediateSupplier and InterruptingImmediateSupplier
for true non-blocking evaluation, with some other tricks used in other places.
Some non-reliable calls may still fail, but most have been repaired,
and the rest should be.
(If the old semantics are _really_ needed you can resolve with a short wait.)
Re-enables many of the tests disabled for https://issues.apache.org/jira/browse/BROOKLYN-272
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/3821e02c
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/3821e02c
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/3821e02c
Branch: refs/heads/master
Commit: 3821e02c504382cb5a5a2411ddecda5b58b73136
Parents: 0d77dbc
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Feb 20 15:48:46 2017 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Feb 20 17:25:56 2017 +0000
----------------------------------------------------------------------
.../spi/dsl/DslDeferredFunctionCall.java | 3 +-
.../spi/dsl/methods/BrooklynDslCommon.java | 15 +---
.../brooklyn/spi/dsl/methods/DslComponent.java | 10 +--
.../brooklyn/camp/brooklyn/ConfigYamlTest.java | 32 +-------
.../config/internal/AbstractConfigMapImpl.java | 3 +
.../AbstractConfigurationSupportInternal.java | 57 +++++++-------
.../core/objs/BrooklynObjectInternal.java | 13 +++-
.../core/sensor/DependentConfiguration.java | 15 ++--
.../util/core/task/ImmediateSupplier.java | 43 ++++++++++-
.../task/InterruptingImmediateSupplier.java | 7 +-
.../brooklyn/util/core/task/ValueResolver.java | 78 ++++++++------------
.../brooklyn/core/entity/EntityConfigTest.java | 18 ++---
.../util/core/task/ValueResolverTest.java | 34 ++++++---
.../org/apache/brooklyn/util/guava/Maybe.java | 9 +++
14 files changed, 182 insertions(+), 155 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java
index b8387b3..1c1cef5 100644
--- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java
+++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslDeferredFunctionCall.java
@@ -27,6 +27,7 @@ import org.apache.brooklyn.api.mgmt.Task;
import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.BrooklynDslCommon;
import org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslToStringHelpers;
import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
+import org.apache.brooklyn.util.core.task.ImmediateSupplier;
import org.apache.brooklyn.util.core.task.Tasks;
import org.apache.brooklyn.util.exceptions.Exceptions;
import org.apache.brooklyn.util.guava.Maybe;
@@ -94,7 +95,7 @@ public class DslDeferredFunctionCall extends BrooklynDslDeferredSupplier<Object>
return invokeOn(instance);
} else {
if (immediate) {
- return Maybe.absent("Could not evaluate immediately: " + obj);
+ return Maybe.absent(new ImmediateSupplier.ImmediateValueNotAvailableException("Could not evaluate immediately: " + obj));
} else {
return Maybe.absent(Maybe.getException(resolvedMaybe));
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
index 2836895..e0ba90f 100644
--- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
+++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
@@ -589,18 +589,11 @@ public class BrooklynDslCommon {
final Class<?> clazz = getOrLoadType();
final ExecutionContext executionContext = entity().getExecutionContext();
- // Marker exception that one of our component-parts cannot yet be resolved -
- // throwing and catching this allows us to abort fast.
- // A bit messy to use exceptions in normal control flow, but this allows the Maps util methods to be used.
- @SuppressWarnings("serial")
- class UnavailableException extends RuntimeException {
- }
-
final Function<Object, Object> resolver = new Function<Object, Object>() {
@Override public Object apply(Object value) {
Maybe<Object> result = Tasks.resolving(value, Object.class).context(executionContext).deep(true).immediately(true).getMaybe();
if (result.isAbsent()) {
- throw new UnavailableException();
+ throw new ImmediateValueNotAvailableException();
} else {
return result.get();
}
@@ -620,8 +613,8 @@ public class BrooklynDslCommon {
result = create(clazz, factoryMethodName, resolvedFactoryMethodArgs, resolvedFields, resolvedConfig);
}
return Maybe.of(result);
- } catch (UnavailableException e) {
- return Maybe.absent();
+ } catch (ImmediateValueNotAvailableException e) {
+ return ImmediateValueNotAvailableException.newAbsentWithExceptionSupplier();
}
}
@@ -873,7 +866,7 @@ public class BrooklynDslCommon {
public Maybe<Entity> getImmediately() {
EntityInternal entity = entity();
if (entity == null) {
- return Maybe.absent();
+ return Maybe.absent("No entity available");
}
Entity targetEntity = entity.getManagementContext().getEntityManager().getEntity(entityId);
return Maybe.of(targetEntity);
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
index 1cce90e..0d2213a 100644
--- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
+++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
@@ -288,7 +288,7 @@ public class DslComponent extends BrooklynDslDeferredSupplier<Entity> implements
if (immediate) {
if (maybeComponentId.isAbsent()) {
- return Maybe.absent(Maybe.getException(maybeComponentId));
+ return ImmediateValueNotAvailableException.newAbsentWrapping("Cannot find component ID", maybeComponentId);
}
}
@@ -418,7 +418,7 @@ public class DslComponent extends BrooklynDslDeferredSupplier<Entity> implements
@Override
public Maybe<Object> getImmediately() {
Maybe<Entity> targetEntityMaybe = component.getImmediately();
- if (targetEntityMaybe.isAbsent()) return Maybe.absent("Target entity not available");
+ if (targetEntityMaybe.isAbsent()) return ImmediateValueNotAvailableException.newAbsentWrapping("Target entity is not available: "+component, targetEntityMaybe);
Entity targetEntity = targetEntityMaybe.get();
return Maybe.<Object>of(targetEntity.getId());
@@ -477,7 +477,7 @@ public class DslComponent extends BrooklynDslDeferredSupplier<Entity> implements
@Override
public final Maybe<Object> getImmediately() {
Maybe<Entity> targetEntityMaybe = component.getImmediately();
- if (targetEntityMaybe.isAbsent()) return Maybe.absent("Target entity not available");
+ if (targetEntityMaybe.isAbsent()) return ImmediateValueNotAvailableException.newAbsentWrapping("Target entity not available: "+component, targetEntityMaybe);
Entity targetEntity = targetEntityMaybe.get();
String sensorNameS = resolveSensorName(true);
@@ -486,7 +486,7 @@ public class DslComponent extends BrooklynDslDeferredSupplier<Entity> implements
targetSensor = Sensors.newSensor(Object.class, sensorNameS);
}
Object result = targetEntity.sensors().get(targetSensor);
- return GroovyJavaMethods.truth(result) ? Maybe.of(result) : Maybe.absent();
+ return GroovyJavaMethods.truth(result) ? Maybe.of(result) : ImmediateValueNotAvailableException.newAbsentWithExceptionSupplier();
}
@SuppressWarnings("unchecked")
@@ -660,7 +660,7 @@ public class DslComponent extends BrooklynDslDeferredSupplier<Entity> implements
return Maybe.<Sensor<?>>of((Sensor<?>)si);
} else if (si instanceof String) {
Maybe<Entity> targetEntityMaybe = component.getImmediately();
- if (targetEntityMaybe.isAbsent()) return Maybe.absent("Target entity not available");
+ if (targetEntityMaybe.isAbsent()) return ImmediateValueNotAvailableException.newAbsentWrapping("Target entity is not available: "+component, targetEntityMaybe);
Entity targetEntity = targetEntityMaybe.get();
Sensor<?> result = null;
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
index e1f1708..53a6be8 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
@@ -307,16 +307,7 @@ public class ConfigYamlTest extends AbstractYamlTest {
assertEquals(entity.config().get(TestEntity.CONF_SET_PLAIN), ImmutableSet.of("myOther"));
}
- /**
- * TODO The {@code entity.config().getNonBlocking()} can return absent. When it's called with
- * a deferred supplier value, it will kick off a task and then wait just a few millis for that
- * task to execute deferredSupplier.get(). If it times out, then it returns Maybe.absent.
- * However, on apache jenkins the machine is often slow so the task doesn't complete in the
- * given number of millis (even though deferredSupplier.get() doesn't need to block for anything).
- * Same for {@link #testDeferredSupplierToAttributeWhenReadyInSpecialTypes()}.
- * See https://issues.apache.org/jira/browse/BROOKLYN-272.
- */
- @Test(groups="Broken")
+ @Test
public void testDeferredSupplierToAttributeWhenReady() throws Exception {
String yaml = Joiner.on("\n").join(
"services:",
@@ -344,17 +335,9 @@ public class ConfigYamlTest extends AbstractYamlTest {
/**
* This tests config keys of type {@link org.apache.brooklyn.core.config.MapConfigKey}, etc.
- * For plain maps, see {@link #testDeferredSupplierToAttributeWhenReadyInPlainCollections()}.
- *
- * TODO The {@code entity.config().getNonBlocking()} can return absent. When it's called with
- * a deferred supplier value, it will kick off a task and then wait just a few millis for that
- * task to execute deferredSupplier.get(). If it times out, then it returns Maybe.absent.
- * However, on apache jenkins the machine is often slow so the task doesn't complete in the
- * given number of millis (even though deferredSupplier.get() doesn't need to block for anything).
- * Same for {@link #testDeferredSupplierToAttributeWhenReady()}.
- * See https://issues.apache.org/jira/browse/BROOKLYN-272.
+ * For plain maps, see {@link #testDeferredSupplierToAttributeWhenReadyInPlainCollections()}
*/
- @Test(groups="Broken")
+ @Test
public void testDeferredSupplierToAttributeWhenReadyInSpecialTypes() throws Exception {
String yaml = Joiner.on("\n").join(
"services:",
@@ -399,15 +382,8 @@ public class ConfigYamlTest extends AbstractYamlTest {
* This tests config keys of type {@link java.util.Map}, etc.
* For special types (e.g. {@link org.apache.brooklyn.core.config.MapConfigKey}), see
* {@link #testDeferredSupplierToAttributeWhenReadyInPlainCollections()}.
- *
- * TODO test doesn't work because getNonBlocking returns even when no value.
- * For example, we get back: Present[value={mykey=attributeWhenReady("myOtherSensor")}].
- * However, the `config().get()` does behave as desired.
- *
- * Including the "WIP" group because this test would presumably have never worked!
- * Added to demonstrate the short-coming.
*/
- @Test(groups={"Broken", "WIP"})
+ @Test
public void testDeferredSupplierToAttributeWhenReadyInPlainCollections() throws Exception {
String yaml = Joiner.on("\n").join(
"services:",
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java b/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java
index b736beb..091f874 100644
--- a/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java
+++ b/core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java
@@ -313,6 +313,9 @@ public abstract class AbstractConfigMapImpl<TContainer extends BrooklynObject> i
// wasteful to make a copy to look up; maybe try once opportunistically?
ownCopy = MutableMap.copyOf(oc);
}
+ // would be cleaner here to have an extractValueMaybe but semantics can get confusing whether absent
+ // means no value can be extracted (getRaw semantics) and immediate mode is on but blocking is needed (ImmediateSupplier semantics);
+ // simpler not to support maybe, in which case here null means the former, and the latter throws something (which the caller catches)
Maybe<Object> result = Maybe.of((Object) ((ConfigKeySelfExtracting<?>) key).extractValue(ownCopy, getExecutionContext(container)) );
postLocalEvaluate(key, bo, value, result);
return result;
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java b/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
index 796ab13..113daac 100644
--- a/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
+++ b/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
@@ -22,8 +22,6 @@ package org.apache.brooklyn.core.objs;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeoutException;
import javax.annotation.Nullable;
@@ -41,8 +39,9 @@ import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
import org.apache.brooklyn.util.collections.MutableMap;
import org.apache.brooklyn.util.core.config.ConfigBag;
import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.core.task.ImmediateSupplier.ImmediateUnsupportedException;
+import org.apache.brooklyn.util.core.task.ImmediateSupplier.ImmediateValueNotAvailableException;
import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.core.task.ValueResolver;
import org.apache.brooklyn.util.exceptions.Exceptions;
import org.apache.brooklyn.util.exceptions.RuntimeInterruptedException;
import org.apache.brooklyn.util.guava.Maybe;
@@ -53,6 +52,7 @@ import com.google.common.base.Predicate;
public abstract class AbstractConfigurationSupportInternal implements BrooklynObjectInternal.ConfigurationSupportInternal {
+ @SuppressWarnings("unused")
private static final Logger LOG = LoggerFactory.getLogger(AbstractConfigurationSupportInternal.class);
@Override
@@ -77,10 +77,16 @@ public abstract class AbstractConfigurationSupportInternal implements BrooklynOb
@Override
public <T> Maybe<T> getNonBlocking(final ConfigKey<T> key) {
- if (key instanceof StructuredConfigKey || key instanceof SubElementConfigKey) {
- return getNonBlockingResolvingStructuredKey(key);
- } else {
- return getNonBlockingResolvingSimple(key);
+ try {
+ if (key instanceof StructuredConfigKey || key instanceof SubElementConfigKey) {
+ return getNonBlockingResolvingStructuredKey(key);
+ } else {
+ return getNonBlockingResolvingSimple(key);
+ }
+ } catch (ImmediateValueNotAvailableException e) {
+ return Maybe.absent(e);
+ } catch (ImmediateUnsupportedException e) {
+ return Maybe.absent(e);
}
}
@@ -89,12 +95,6 @@ public abstract class AbstractConfigurationSupportInternal implements BrooklynOb
* execute the custom logic, as is done by {@link #get(ConfigKey)}, but non-blocking!
*/
protected <T> Maybe<T> getNonBlockingResolvingStructuredKey(final ConfigKey<T> key) {
- // TODO This is a poor implementation. We risk timing out when it's just doing its
- // normal work (e.g. because job's thread was starved), rather than when it's truly
- // blocked. Really we'd need to dig into the implementation of get(key), so that the
- // underlying work can be configured with a timeout, for when it finally calls
- // ValueResolver.
-
Callable<T> job = new Callable<T>() {
@Override
public T call() {
@@ -106,22 +106,15 @@ public abstract class AbstractConfigurationSupportInternal implements BrooklynOb
}
};
- Task<T> t = getContext().submit(Tasks.<T>builder().body(job)
+ Task<T> t = Tasks.<T>builder().body(job)
.displayName("Resolving dependent value")
.description("Resolving "+key.getName())
.tag(BrooklynTaskTags.TRANSIENT_TASK_TAG)
- .build());
+ .build();
try {
- T result = t.get(ValueResolver.NON_BLOCKING_WAIT);
- return Maybe.of(result);
- } catch (TimeoutException e) {
- t.cancel(true);
- return Maybe.<T>absent();
- } catch (ExecutionException e) {
- LOG.debug("Problem resolving "+key.getName()+", returning <absent>", e);
- return Maybe.<T>absent();
- } catch (InterruptedException e) {
- throw Exceptions.propagate(e);
+ return getContext().getImmediately(t);
+ } catch (ImmediateUnsupportedException e) {
+ return Maybe.absent();
}
}
@@ -139,17 +132,19 @@ public abstract class AbstractConfigurationSupportInternal implements BrooklynOb
// or Absent if the config key was unset.
Object unresolved = getRaw(key).or(key.getDefaultValue());
final Object marker = new Object();
- // Give tasks a short grace period to resolve.
- Object resolved = Tasks.resolving(unresolved)
+ Maybe<Object> resolved = Tasks.resolving(unresolved)
.as(Object.class)
.defaultValue(marker)
.immediately(true)
.deep(true)
.context(getContext())
- .get();
- return (resolved != marker)
- ? TypeCoercions.tryCoerce(resolved, key.getTypeToken())
- : Maybe.<T>absent();
+ .getMaybe();
+ if (resolved.isAbsent()) return Maybe.Absent.<T>castAbsent(resolved);
+ if (resolved.get()==marker) {
+ // TODO changed Feb 2017, previously returned absent, in contrast to what the javadoc says
+ return Maybe.of((T)null);
+ }
+ return TypeCoercions.tryCoerce(resolved.get(), key.getTypeToken());
}
@Override
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/core/src/main/java/org/apache/brooklyn/core/objs/BrooklynObjectInternal.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/objs/BrooklynObjectInternal.java b/core/src/main/java/org/apache/brooklyn/core/objs/BrooklynObjectInternal.java
index 86daf1f..3fc2c99 100644
--- a/core/src/main/java/org/apache/brooklyn/core/objs/BrooklynObjectInternal.java
+++ b/core/src/main/java/org/apache/brooklyn/core/objs/BrooklynObjectInternal.java
@@ -28,6 +28,8 @@ import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
import org.apache.brooklyn.config.ConfigMap.ConfigMapWithInheritance;
import org.apache.brooklyn.util.core.config.ConfigBag;
+import org.apache.brooklyn.util.core.task.ImmediateSupplier;
+import org.apache.brooklyn.util.core.task.ImmediateSupplier.ImmediateUnsupportedException;
import org.apache.brooklyn.util.guava.Maybe;
import com.google.common.annotations.Beta;
@@ -113,13 +115,20 @@ public interface BrooklynObjectInternal extends BrooklynObject, Rebindable {
/**
* Attempts to coerce the value for this config key, if available,
- * taking a default and {@link Maybe#absent absent} if the uncoerced
- * cannot be resolved within a short timeframe.
+ * including returning a default if the config key is unset,
+ * returning a {@link Maybe#absent absent} if the uncoerced
+ * does not support immediate resolution.
* <p>
* Note: if no value for the key is available, not even as a default,
* this returns a {@link Maybe#isPresent()} containing <code>null</code>
* (following the semantics of {@link #get(ConfigKey)}
* rather than {@link #getRaw(ConfigKey)}).
+ * Thus a {@link Maybe#absent()} definitively indicates that
+ * the absence is due to the request to evaluate immediately.
+ * <p>
+ * This will include catching {@link ImmediateUnsupportedException}
+ * and returning it as an absence, thus making the semantics here slightly
+ * "safer" than that of {@link ImmediateSupplier#getImmediately()}.
*/
@Beta
<T> Maybe<T> getNonBlocking(ConfigKey<T> key);
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java b/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java
index ca79d73..32a409f 100644
--- a/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java
+++ b/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java
@@ -68,6 +68,7 @@ import org.apache.brooklyn.util.exceptions.RuntimeTimeoutException;
import org.apache.brooklyn.util.groovy.GroovyJavaMethods;
import org.apache.brooklyn.util.guava.Functionals;
import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.guava.Maybe.Absent;
import org.apache.brooklyn.util.net.Urls;
import org.apache.brooklyn.util.text.StringFunctions;
import org.apache.brooklyn.util.text.StringFunctions.RegexReplacer;
@@ -499,7 +500,7 @@ public class DependentConfiguration {
List<Object> resolvedArgs = Lists.newArrayList();
for (Object arg : args) {
Maybe<?> argVal = resolveImmediately(arg);
- if (argVal.isAbsent()) return Maybe.absent();
+ if (argVal.isAbsent()) return Maybe.Absent.castAbsent(argVal);
resolvedArgs.add(argVal.get());
}
@@ -511,7 +512,7 @@ public class DependentConfiguration {
*/
public static Maybe<String> urlEncodeImmediately(Object arg) {
Maybe<?> resolvedArg = resolveImmediately(arg);
- if (resolvedArg.isAbsent()) return Maybe.absent();
+ if (resolvedArg.isAbsent()) return Absent.castAbsent(resolvedArg);
if (resolvedArg.isNull()) return Maybe.<String>of((String)null);
String resolvedString = resolvedArg.get().toString();
@@ -564,15 +565,15 @@ public class DependentConfiguration {
public static Maybe<String> regexReplacementImmediately(Object source, Object pattern, Object replacement) {
Maybe<?> resolvedSource = resolveImmediately(source);
- if (resolvedSource.isAbsent()) return Maybe.absent();
+ if (resolvedSource.isAbsent()) return Absent.castAbsent(resolvedSource);
String resolvedSourceStr = String.valueOf(resolvedSource.get());
Maybe<?> resolvedPattern = resolveImmediately(pattern);
- if (resolvedPattern.isAbsent()) return Maybe.absent();
+ if (resolvedPattern.isAbsent()) return Absent.castAbsent(resolvedPattern);
String resolvedPatternStr = String.valueOf(resolvedPattern.get());
Maybe<?> resolvedReplacement = resolveImmediately(replacement);
- if (resolvedReplacement.isAbsent()) return Maybe.absent();
+ if (resolvedReplacement.isAbsent()) return Absent.castAbsent(resolvedReplacement);
String resolvedReplacementStr = String.valueOf(resolvedReplacement.get());
String result = new StringFunctions.RegexReplacer(resolvedPatternStr, resolvedReplacementStr).apply(resolvedSourceStr);
@@ -591,11 +592,11 @@ public class DependentConfiguration {
public static Maybe<Function<String, String>> regexReplacementImmediately(Object pattern, Object replacement) {
Maybe<?> resolvedPattern = resolveImmediately(pattern);
- if (resolvedPattern.isAbsent()) return Maybe.absent();
+ if (resolvedPattern.isAbsent()) return Absent.castAbsent(resolvedPattern);
String resolvedPatternStr = String.valueOf(resolvedPattern.get());
Maybe<?> resolvedReplacement = resolveImmediately(replacement);
- if (resolvedReplacement.isAbsent()) return Maybe.absent();
+ if (resolvedReplacement.isAbsent()) return Absent.castAbsent(resolvedReplacement);
String resolvedReplacementStr = String.valueOf(resolvedReplacement.get());
RegexReplacer result = new StringFunctions.RegexReplacer(resolvedPatternStr, resolvedReplacementStr);
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/core/src/main/java/org/apache/brooklyn/util/core/task/ImmediateSupplier.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/ImmediateSupplier.java b/core/src/main/java/org/apache/brooklyn/util/core/task/ImmediateSupplier.java
index 5ec8d68..522c361 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/task/ImmediateSupplier.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/task/ImmediateSupplier.java
@@ -45,9 +45,48 @@ public interface ImmediateSupplier<T> extends Supplier<T> {
}
/**
- * Gets the value promptly, or returns {@link Maybe#absent()} if the value is not yet available.
+ * Indicates that an attempt was made to forcibly get a requested immediate value
+ * where blocking is required. See {@link ImmediateSupplier#getImmediately()}, which if
+ * it returns an absent result, that absent will throw this.
+ * <p>
+ * This is useful for passing between contexts that support immediate evaluation,
+ * through contexts that do not, to outer contexts which do, as the outer context
+ * will be able to use this exception to return a {@link Maybe#absent()} rather than throwing.
+ */
+ public static class ImmediateValueNotAvailableException extends RuntimeException {
+ private static final long serialVersionUID = -5860437285154375232L;
+
+ public ImmediateValueNotAvailableException() { }
+ public ImmediateValueNotAvailableException(String message) {
+ super(message);
+ }
+ public ImmediateValueNotAvailableException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ public static <T> Maybe<T> newAbsentWithExceptionSupplier() {
+ return Maybe.Absent.changeExceptionSupplier(Maybe.<T>absent(), ImmediateValueNotAvailableException.class);
+ }
+ public static <T> Maybe<T> newAbsentWrapping(String message, Maybe<?> inner) {
+ return Maybe.absent(new ImmediateValueNotAvailableException(message, Maybe.getException(inner)));
+ }
+ }
+
+ /**
+ * Gets the value promptly, or returns {@link Maybe#absent()} if the value requires blocking,
+ * or throws {@link ImmediateUnsupportedException} if it cannot be determined whether the value requires blocking or not.
+ * <p>
+ * The {@link Maybe#absent()} returned here indicates that a value definitively <i>is</i> pending, just it is not yet available,
+ * and an attempt to {@link Maybe#get()} it should throw an {@link ImmediateValueNotAvailableException};
+ * it can be created with {@link ImmediateValueNotAvailableException#newAbsentWithExceptionSupplier()} to
+ * avoid creating traces (or simply with <code>Maybe.absent(new ImmediateValueNotAvailableException(...))</code>).
+ * This is in contrast with this method throwing a {@link ImmediateUnsupportedException} which should be done
+ * if the presence of an eventual value cannot even be determined in a non-blocking way.
+ * <p>
+ * Implementations of this method should typically catch the former exception if encountered and return a
+ * {@link Maybe#absent()} wrapping it, whereas {@link ImmediateUnsupportedException} instances should be propagated.
*
- * @throws ImmediateUnsupportedException if cannot determine whether a value is immediately available
+ * @throws ImmediateUnsupportedException as above, if cannot be determined whether a value is or might eventually be available
*/
Maybe<T> getImmediately();
+
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/core/src/main/java/org/apache/brooklyn/util/core/task/InterruptingImmediateSupplier.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/InterruptingImmediateSupplier.java b/core/src/main/java/org/apache/brooklyn/util/core/task/InterruptingImmediateSupplier.java
index 84b1bb4..0a34a18 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/task/InterruptingImmediateSupplier.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/task/InterruptingImmediateSupplier.java
@@ -58,9 +58,12 @@ public class InterruptingImmediateSupplier<T> implements ImmediateSupplier<T>, D
if (!interrupted) Thread.currentThread().interrupt();
return Maybe.ofAllowingNull(get());
} catch (Throwable t) {
+ if (Exceptions.getFirstThrowableOfType(t, ImmediateValueNotAvailableException.class)!=null) {
+ return Maybe.absent(Exceptions.getFirstThrowableOfType(t, ImmediateValueNotAvailableException.class));
+ }
if (Exceptions.getFirstThrowableOfType(t, InterruptedException.class)!=null ||
Exceptions.getFirstThrowableOfType(t, RuntimeInterruptedException.class)!=null) {
- return Maybe.absent(new UnsupportedOperationException("Immediate value not available", t));
+ return Maybe.absent(new ImmediateValueNotAvailableException("Immediate value not available, required non-blocking execution", t));
}
throw Exceptions.propagate(t);
} finally {
@@ -105,7 +108,7 @@ public class InterruptingImmediateSupplier<T> implements ImmediateSupplier<T>, D
}
}
- public static class InterruptingImmediateSupplierNotSupportedForObject extends UnsupportedOperationException {
+ public static class InterruptingImmediateSupplierNotSupportedForObject extends ImmediateUnsupportedException {
private static final long serialVersionUID = 307517409005386500L;
public InterruptingImmediateSupplierNotSupportedForObject(Object o) {
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java b/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
index f8cb91b..4446d92 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
@@ -33,6 +33,8 @@ import org.apache.brooklyn.api.mgmt.TaskFactory;
import org.apache.brooklyn.core.entity.EntityInternal;
import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.core.task.ImmediateSupplier.ImmediateUnsupportedException;
+import org.apache.brooklyn.util.core.task.ImmediateSupplier.ImmediateValueNotAvailableException;
import org.apache.brooklyn.util.exceptions.Exceptions;
import org.apache.brooklyn.util.guava.Maybe;
import org.apache.brooklyn.util.javalang.JavaClassNames;
@@ -275,8 +277,10 @@ public class ValueResolver<T> implements DeferredSupplier<T>, Iterable<Maybe<Obj
}
/**
- * Whether the value should be resolved immediately (and if not available immediately,
- * return absent).
+ * Whether the value should be resolved immediately
+ * (following {@link ImmediateSupplier#getImmediately()} semantics with regards to when errors may be thrown,
+ * except some cases where {@link ImmediateUnsupportedException} is thrown may be re-run with a {@link #NON_BLOCKING_WAIT}
+ * after which the more definitive {@link ImmediateValueNotAvailableException} will be thrown/wrapped.
*/
@Beta
public ValueResolver<T> immediately(boolean val) {
@@ -364,19 +368,15 @@ public class ValueResolver<T> implements DeferredSupplier<T>, Iterable<Maybe<Obj
boolean allowImmediateExecution = false;
boolean bailOutAfterImmediateExecution = false;
- if (v instanceof ImmediateSupplier) {
+ if (v instanceof ImmediateSupplier || v instanceof DeferredSupplier) {
allowImmediateExecution = true;
} else {
- if ((v instanceof TaskFactory<?>) && !(v instanceof DeferredSupplier)) {
+ if (v instanceof TaskFactory<?>) {
v = ((TaskFactory<?>)v).newTask();
allowImmediateExecution = true;
bailOutAfterImmediateExecution = true;
BrooklynTaskTags.setTransient(((TaskAdaptable<?>)v).asTask());
- if (isEvaluatingImmediately()) {
- // not needed if executing immediately
- BrooklynTaskTags.addTagDynamically( ((TaskAdaptable<?>)v).asTask(), BrooklynTaskTags.IMMEDIATE_TASK_TAG );
- }
}
//if it's a task or a future, we wait for the task to complete
@@ -384,31 +384,32 @@ public class ValueResolver<T> implements DeferredSupplier<T>, Iterable<Maybe<Obj
v = ((TaskAdaptable<?>) v).asTask();
}
}
-
+
if (allowImmediateExecution && isEvaluatingImmediately()) {
- // TODO could allow for everything, when evaluating immediately -- but if the target isn't safe to run again
- // then we have to fail if immediate didn't work; to avoid breaking semantics we only do that for a few cases;
- // might be nice to get to the point where we can break those semantics however,
- // ie weakening what getImmediate supports and making it be non-blocking, so that bailOut=true is the default.
- // if: v instanceof TaskFactory -- it is safe, it's a new API (but it is currently the only one supported);
- // more than safe, we have to do it -- or add code here to cancel tasks -- because it spawns new tasks
- // (other objects passed through here don't get cancelled, because other things might try again later;
- // ie a task or future passed in here might naturally be long-running so cancelling is wrong,
- // but with a task factory generated task it would leak if we submitted and didn't cancel!)
- // if: v instanceof ImmediateSupplier -- it probably is safe to change to bailOut = true ?
- // if: v instanceof Task or other things -- it currently isn't safe, there are places where
- // we expect to getImmediate on things which don't support it nicely,
- // and we rely on the blocking-short-wait behaviour, e.g. QuorumChecks in ConfigYamlTest
+ // Feb 2017 - many things now we try to run immediate; notable exceptions are:
+ // * where the target isn't safe to run again (such as a Task which someone else might need),
+ // * or where he can't be run in an "interrupting" mode even if non-blocking (eg Future.get(), some other tasks)
+ // (the latter could be tried here, with bailOut false, but in most cases it will just throw so we still need to
+ // have the timings as in SHORT_WAIT etc as a fallack)
+
+ Maybe<T> result = null;
try {
- Maybe<T> result = execImmediate(exec, v);
- if (result!=null) return result;
+ result = exec.getImmediately(v);
+
+ return (result.isPresent())
+ ? recursive
+ ? new ValueResolver<T>(result.get(), type, this).getMaybe()
+ : result
+ : result;
+ } catch (ImmediateSupplier.ImmediateUnsupportedException e) {
if (bailOutAfterImmediateExecution) {
throw new ImmediateSupplier.ImmediateUnsupportedException("Cannot get immediately: "+v);
}
- } catch (InterruptingImmediateSupplier.InterruptingImmediateSupplierNotSupportedForObject o) {
- // ignore, continue below
- log.debug("Unable to resolve-immediately for "+description+" ("+v+", wrong type "+v.getClass()+"); falling back to executing with timeout");
- }
+ // else proceed to below
+ } catch (ImmediateSupplier.ImmediateValueNotAvailableException e) {
+ // definitively not available
+ return ImmediateSupplier.ImmediateValueNotAvailableException.newAbsentWithExceptionSupplier();
+ }
}
if (v instanceof Task) {
@@ -472,8 +473,7 @@ public class ValueResolver<T> implements DeferredSupplier<T>, Iterable<Maybe<Obj
.description(description);
if (isTransientTask) tb.tag(BrooklynTaskTags.TRANSIENT_TASK_TAG);
- // Note that immediate resolution is handled by using ImmediateSupplier (using an instanceof check),
- // so that it executes in the current thread instead of using task execution.
+ // immediate resolution is handled above
Task<Object> vt = exec.submit(tb.build());
Maybe<Object> vm = Durations.get(vt, timer);
vt.cancel(true);
@@ -559,24 +559,6 @@ public class ValueResolver<T> implements DeferredSupplier<T>, Iterable<Maybe<Obj
}
}
- protected Maybe<T> execImmediate(ExecutionContext exec, Object immediateSupplierOrImmediateTask) {
- Maybe<T> result;
- try {
- result = exec.getImmediately(immediateSupplierOrImmediateTask);
- } catch (ImmediateSupplier.ImmediateUnsupportedException e) {
- return null;
- }
- // let InterruptingImmediateSupplier.InterruptingImmediateSupplierNotSupportedForObject
- // bet thrown, and caller who cares will catch that to know it can continue
-
- // Recurse: need to ensure returned value is cast, etc
- return (result.isPresent())
- ? recursive
- ? new ValueResolver<T>(result.get(), type, this).getMaybe()
- : result
- : result;
- }
-
protected String getDescription() {
return description!=null ? description : ""+value;
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/core/src/test/java/org/apache/brooklyn/core/entity/EntityConfigTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/entity/EntityConfigTest.java b/core/src/test/java/org/apache/brooklyn/core/entity/EntityConfigTest.java
index 2f40fe9..90f8a12 100644
--- a/core/src/test/java/org/apache/brooklyn/core/entity/EntityConfigTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/entity/EntityConfigTest.java
@@ -374,7 +374,7 @@ public class EntityConfigTest extends BrooklynAppUnitTestSupport {
assertAllOurConfigTasksCancelled();
} else {
// TaskFactory tasks are cancelled, but others are not,
- // things (ValueResolver?) are smart enough to know to leave it running
+ // things (ValueResolver.getMaybeInternal()) are smart enough to know to leave it running
assertAllOurConfigTasksNotCancelled();
}
@@ -411,30 +411,30 @@ public class EntityConfigTest extends BrooklynAppUnitTestSupport {
}
}
- @Test(groups="Integration") // because takes 1s+
+ @Test(groups="Integration") // still takes 1s+ -- because we don't want to interrupt the task, we have to run it in BG
public void testGetTaskNonBlockingKey() throws Exception {
new ConfigNonBlockingFixture().usingTask().runGetConfigNonBlockingInKey();
}
- @Test(groups="Integration") // because takes 1s+
+ @Test
public void testGetTaskNonBlockingMap() throws Exception {
new ConfigNonBlockingFixture().usingTask().runGetConfigNonBlockingInMap();
}
- @Test(groups="Integration") // because takes 1s+
+ @Test
public void testGetTaskFactoryNonBlockingKey() throws Exception {
new ConfigNonBlockingFixture().usingTaskFactory().runGetConfigNonBlockingInKey();
}
- @Test(groups="Integration") // because takes 1s+
+ @Test
public void testGetTaskFactoryNonBlockingMap() throws Exception {
new ConfigNonBlockingFixture().usingTaskFactory().runGetConfigNonBlockingInMap();
}
- @Test(groups="Integration") // because takes 1s+
+ @Test
public void testGetSupplierNonBlockingKey() throws Exception {
new ConfigNonBlockingFixture().usingDeferredSupplier().runGetConfigNonBlockingInKey();
}
- @Test(groups="Integration") // because takes 1s+
- public void testGetSuppierNonBlockingMap() throws Exception {
+ @Test
+ public void testGetSupplierNonBlockingMap() throws Exception {
new ConfigNonBlockingFixture().usingDeferredSupplier().runGetConfigNonBlockingInMap();
}
@@ -442,7 +442,7 @@ public class EntityConfigTest extends BrooklynAppUnitTestSupport {
public void testGetImmediateSupplierNonBlockingKey() throws Exception {
new ConfigNonBlockingFixture().usingImmediateSupplier().runGetConfigNonBlockingInKey();
}
- @Test(groups="Integration") // because takes 1s+
+ @Test
public void testGetImmediateSupplierNonBlockingMap() throws Exception {
new ConfigNonBlockingFixture().usingImmediateSupplier().runGetConfigNonBlockingInMap();
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/core/src/test/java/org/apache/brooklyn/util/core/task/ValueResolverTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/util/core/task/ValueResolverTest.java b/core/src/test/java/org/apache/brooklyn/util/core/task/ValueResolverTest.java
index 550d475..c9c76fb 100644
--- a/core/src/test/java/org/apache/brooklyn/util/core/task/ValueResolverTest.java
+++ b/core/src/test/java/org/apache/brooklyn/util/core/task/ValueResolverTest.java
@@ -32,6 +32,7 @@ import org.apache.brooklyn.api.mgmt.TaskFactory;
import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport;
import org.apache.brooklyn.test.Asserts;
+import org.apache.brooklyn.util.core.task.ImmediateSupplier.ImmediateValueNotAvailableException;
import org.apache.brooklyn.util.guava.Maybe;
import org.apache.brooklyn.util.time.Duration;
import org.apache.brooklyn.util.time.Time;
@@ -169,11 +170,26 @@ public class ValueResolverTest extends BrooklynAppUnitTestSupport {
assertImmediateFakeTaskFromMethod(callInfo, "myUniquelyNamedMethod");
}
- public void testGetImmediatelyFallsBackToDeferredCallInTask() throws Exception {
- final MyImmediateAndDeferredSupplier supplier = new MyImmediateAndDeferredSupplier(true);
+ public void testGetImmediatelyFallsBackToDeferredCallInTaskOnUnsupported() throws Exception {
+ final MyImmediateAndDeferredSupplier supplier = new MyImmediateAndDeferredSupplier(new ImmediateSupplier.ImmediateUnsupportedException("Simulate immediate unsupported"));
CallInfo callInfo = Tasks.resolving(supplier).as(CallInfo.class).context(app).immediately(true).get();
- assertRealTaskNotFromMethod(callInfo, "testGetImmediatelyFallsBackToDeferredCallInTask");
+ assertNotNull(callInfo.task);
assertEquals(BrooklynTaskTags.getContextEntity(callInfo.task), app);
+ assertNotContainsCallingMethod(callInfo.stackTrace, "testGetImmediatelyFallsBackToDeferredCallInTask");
+ }
+
+ public void testGetImmediatelyDoesntFallBackToDeferredCallOnNotAvailable() throws Exception {
+ final MyImmediateAndDeferredSupplier supplier = new MyImmediateAndDeferredSupplier(new ImmediateSupplier.ImmediateValueNotAvailableException());
+ Maybe<CallInfo> callInfo = Tasks.resolving(supplier).as(CallInfo.class).context(app).immediately(true).getMaybe();
+ Asserts.assertNotPresent(callInfo);
+
+ try {
+ callInfo.get();
+ Asserts.shouldHaveFailedPreviously("resolution should have failed now the ImmediateSupplier is not expected to fallback to other evaluation forms; instead got "+callInfo);
+
+ } catch (Exception e) {
+ Asserts.expectedFailureOfType(e, ImmediateValueNotAvailableException.class);
+ }
}
public void testNonRecursiveBlockingFailsOnNonObjectType() throws Exception {
@@ -271,20 +287,20 @@ public class ValueResolverTest extends BrooklynAppUnitTestSupport {
}
private static class MyImmediateAndDeferredSupplier implements ImmediateSupplier<CallInfo>, DeferredSupplier<CallInfo> {
- private final boolean failImmediately;
+ private final RuntimeException failImmediately;
public MyImmediateAndDeferredSupplier() {
- this(false);
+ this(null);
}
- public MyImmediateAndDeferredSupplier(boolean simulateImmediateUnsupported) {
- this.failImmediately = simulateImmediateUnsupported;
+ public MyImmediateAndDeferredSupplier(RuntimeException failImmediately) {
+ this.failImmediately = failImmediately;
}
@Override
public Maybe<CallInfo> getImmediately() {
- if (failImmediately) {
- throw new ImmediateSupplier.ImmediateUnsupportedException("Simulate immediate unsupported");
+ if (failImmediately!=null) {
+ throw failImmediately;
} else {
return Maybe.of(CallInfo.newInstance());
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3821e02c/utils/common/src/main/java/org/apache/brooklyn/util/guava/Maybe.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/guava/Maybe.java b/utils/common/src/main/java/org/apache/brooklyn/util/guava/Maybe.java
index 2dfe627..b115acb 100644
--- a/utils/common/src/main/java/org/apache/brooklyn/util/guava/Maybe.java
+++ b/utils/common/src/main/java/org/apache/brooklyn/util/guava/Maybe.java
@@ -365,6 +365,15 @@ public abstract class Maybe<T> implements Serializable, Supplier<T> {
return Maybe.absent(transform.apply((AnyExceptionSupplier<?>)supplier));
}
+ /** Like {@link #cast(Maybe)} but allows any casting because that is valid for absents.
+ * Enforces that the argument really is absent. */
+ @SuppressWarnings("unchecked")
+ public static <T> Maybe<T> castAbsent(Maybe<?> absent) {
+ if (absent!=null && absent.isPresent()) {
+ throw new IllegalArgumentException("Expected an absent, but instead got: "+absent);
+ }
+ return (Maybe<T>)absent;
+ }
}
public static class AbsentNull<T> extends Absent<T> {
[04/11] brooklyn-server git commit: Merge branch 'master' into
config-immediate-more
Posted by he...@apache.org.
Merge branch 'master' into config-immediate-more
a couple conflicts in cleanup to exec immediately
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/ce094d75
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/ce094d75
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/ce094d75
Branch: refs/heads/master
Commit: ce094d7595b502493cebc565008d3855d5ebdee7
Parents: b61b46e 94c6a30
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Fri Mar 3 16:17:54 2017 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Mar 3 16:17:54 2017 +0000
----------------------------------------------------------------------
.../brooklyn/spi/dsl/methods/DslComponent.java | 6 +-
.../methods/FormatStringIntegrationTest.java | 76 ------
.../methods/FormatStringIntegrationTest.java | 76 ++++++
.../catalog/internal/BasicBrooklynCatalog.java | 2 +-
.../impl/DeleteOrphanedStateTransformer.java | 8 +-
.../core/sensor/ssh/SshCommandSensor.java | 6 +-
.../brooklyn/feed/AbstractCommandFeed.java | 259 ++++++++++++++++++
.../apache/brooklyn/feed/CommandPollConfig.java | 179 +++++++++++++
.../org/apache/brooklyn/feed/ssh/SshFeed.java | 217 +++------------
.../apache/brooklyn/feed/ssh/SshPollConfig.java | 177 +------------
.../brooklyn/util/core/file/ArchiveUtils.java | 29 +-
.../brooklyn/util/core/osgi/BundleMaker.java | 35 ++-
.../util/core/task/BasicExecutionContext.java | 8 +-
.../brooklyn/util/core/task/CompoundTask.java | 15 ++
.../task/InterruptingImmediateSupplier.java | 4 +-
.../brooklyn/util/core/task/ValueResolver.java | 22 +-
.../deserializingClassRenames.properties | 3 +
.../feed/ssh/SshFeedIntegrationTest.java | 20 +-
.../util/core/task/ValueResolverTest.java | 46 ++++
.../brooklyn/launcher/common/BasicLauncher.java | 6 +-
.../brooklyn/launcher/BrooklynLauncher.java | 2 +-
.../brooklyn/launcher/BrooklynWebServer.java | 12 +-
.../brooklyn/launcher/BrooklynLauncherTest.java | 2 +-
.../CleanOrphanedLocationsIntegrationTest.java | 27 +-
.../brooklyn/launcher/WebAppRunnerTest.java | 34 +--
.../location/jclouds/JcloudsLocation.java | 10 +-
.../apache/brooklyn/rest/domain/ApiError.java | 14 +-
.../rest/resources/ApplicationResource.java | 12 +-
.../rest/resources/EffectorResource.java | 3 +-
.../rest/resources/ErrorResponseTest.java | 21 +-
.../core/sensor/windows/WinRmCommandSensor.java | 167 ++++++++++++
.../apache/brooklyn/feed/windows/CmdFeed.java | 83 ++++++
.../util/core/internal/winrm/WinRmTool.java | 6 +
.../internal/winrm/winrm4j/Winrm4jTool.java | 7 +-
.../feed/windows/WinRmFeedIntegrationTest.java | 262 +++++++++++++++++++
.../util/javalang/LoadedClassLoader.java | 10 +-
.../apache/brooklyn/util/net/Networking.java | 8 +-
.../java/org/apache/brooklyn/util/os/Os.java | 2 +-
38 files changed, 1347 insertions(+), 529 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ce094d75/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ce094d75/core/src/main/java/org/apache/brooklyn/util/core/task/InterruptingImmediateSupplier.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/brooklyn/util/core/task/InterruptingImmediateSupplier.java
index 0a34a18,afbc285..9c7979b
--- a/core/src/main/java/org/apache/brooklyn/util/core/task/InterruptingImmediateSupplier.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/task/InterruptingImmediateSupplier.java
@@@ -58,12 -59,10 +59,13 @@@ public class InterruptingImmediateSuppl
if (!interrupted) Thread.currentThread().interrupt();
return Maybe.ofAllowingNull(get());
} catch (Throwable t) {
+ if (Exceptions.getFirstThrowableOfType(t, ImmediateValueNotAvailableException.class)!=null) {
+ return Maybe.absent(Exceptions.getFirstThrowableOfType(t, ImmediateValueNotAvailableException.class));
+ }
if (Exceptions.getFirstThrowableOfType(t, InterruptedException.class)!=null ||
- Exceptions.getFirstThrowableOfType(t, RuntimeInterruptedException.class)!=null) {
+ Exceptions.getFirstThrowableOfType(t, RuntimeInterruptedException.class)!=null ||
+ Exceptions.getFirstThrowableOfType(t, CancellationException.class)!=null) {
- return Maybe.absent(new UnsupportedOperationException("Immediate value not available", t));
+ return Maybe.absent(new ImmediateValueNotAvailableException("Immediate value not available, required non-blocking execution", t));
}
throw Exceptions.propagate(t);
} finally {
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ce094d75/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
index 4446d92,3c6d96b..c5316fc
--- a/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
@@@ -384,32 -384,36 +384,35 @@@ public class ValueResolver<T> implement
v = ((TaskAdaptable<?>) v).asTask();
}
}
-
+
if (allowImmediateExecution && isEvaluatingImmediately()) {
- // TODO could allow for everything, when evaluating immediately -- but if the target isn't safe to run again
- // then we have to fail if immediate didn't work; to avoid breaking semantics we only do that for a few cases;
- // might be nice to get to the point where we can break those semantics however,
- // ie weakening what getImmediate supports and making it be non-blocking, so that bailOut=true is the default.
- // if: v instanceof TaskFactory -- it is safe, it's a new API (but it is currently the only one supported);
- // more than safe, we have to do it -- or add code here to cancel tasks -- because it spawns new tasks
- // (other objects passed through here don't get cancelled, because other things might try again later;
- // ie a task or future passed in here might naturally be long-running so cancelling is wrong,
- // but with a task factory generated task it would leak if we submitted and didn't cancel!)
- // if: v instanceof ImmediateSupplier -- it probably is safe to change to bailOut = true ?
- // if: v instanceof Task or other things -- it currently isn't safe, there are places where
- // we expect to getImmediate on things which don't support it nicely,
- // and we rely on the blocking-short-wait behaviour, e.g. QuorumChecks in ConfigYamlTest
+ // Feb 2017 - many things now we try to run immediate; notable exceptions are:
+ // * where the target isn't safe to run again (such as a Task which someone else might need),
+ // * or where he can't be run in an "interrupting" mode even if non-blocking (eg Future.get(), some other tasks)
+ // (the latter could be tried here, with bailOut false, but in most cases it will just throw so we still need to
+ // have the timings as in SHORT_WAIT etc as a fallack)
+
+ Maybe<T> result = null;
try {
- Maybe<T> result = execImmediate(exec, v);
- if (result!=null) return result;
- if (bailOutAfterImmediateExecution) {
- throw new ImmediateSupplier.ImmediateUnsupportedException("Cannot get immediately: "+v);
- }
+ result = exec.getImmediately(v);
+
+ return (result.isPresent())
+ ? recursive
+ ? new ValueResolver<T>(result.get(), type, this).getMaybe()
+ : result
+ : result;
} catch (ImmediateSupplier.ImmediateUnsupportedException e) {
if (bailOutAfterImmediateExecution) {
- throw new ImmediateSupplier.ImmediateUnsupportedException("Cannot get immediately: "+v, e);
+ throw new ImmediateSupplier.ImmediateUnsupportedException("Cannot get immediately: "+v);
}
- // else proceed to below
- log.debug("Unable to resolve-immediately for "+description+" ("+v+", unsupported, type "+v.getClass()+"); falling back to executing with timeout: "+e);
- } catch (InterruptingImmediateSupplier.InterruptingImmediateSupplierNotSupportedForObject e) {
+ // ignore, continue below
- log.debug("Unable to resolve-immediately for "+description+" ("+v+", not supported for type "+v.getClass()+"); falling back to executing with timeout: "+e);
++ if (log.isTraceEnabled()) {
++ log.trace("Unable to resolve-immediately for "+description+" ("+v+", unsupported, type "+v.getClass()+"); falling back to executing with timeout: "+e);
++ }
+ } catch (ImmediateSupplier.ImmediateValueNotAvailableException e) {
+ // definitively not available
+ return ImmediateSupplier.ImmediateValueNotAvailableException.newAbsentWithExceptionSupplier();
- }
+ }
}
if (v instanceof Task) {
@@@ -559,6 -564,21 +562,21 @@@
}
}
- /** tries to get immediately, then resolve recursively (including for casting) if {@link #recursive} is set
- *
- * @throws InterruptingImmediateSupplier.InterruptingImmediateSupplierNotSupportedForObject
- * ImmediateSupplier.ImmediateUnsupportedException
- * if underlying call to {@link ExecutionContext#getImmediately(Object)} does so */
- protected Maybe<T> execImmediate(ExecutionContext exec, Object immediateSupplierOrImmediateTask) {
- Maybe<T> result = exec.getImmediately(immediateSupplierOrImmediateTask);
-
- return (result.isPresent())
- ? recursive
- ? new ValueResolver<T>(result.get(), type, this).getMaybe()
- : result
- : result;
- }
++// /** tries to get immediately, then resolve recursively (including for casting) if {@link #recursive} is set
++// *
++// * @throws InterruptingImmediateSupplier.InterruptingImmediateSupplierNotSupportedForObject
++// * ImmediateSupplier.ImmediateUnsupportedException
++// * if underlying call to {@link ExecutionContext#getImmediately(Object)} does so */
++// protected Maybe<T> execImmediate(ExecutionContext exec, Object immediateSupplierOrImmediateTask) {
++// Maybe<T> result = exec.getImmediately(immediateSupplierOrImmediateTask);
++//
++// return (result.isPresent())
++// ? recursive
++// ? new ValueResolver<T>(result.get(), type, this).getMaybe()
++// : result
++// : result;
++// }
+
protected String getDescription() {
return description!=null ? description : ""+value;
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ce094d75/core/src/test/java/org/apache/brooklyn/util/core/task/ValueResolverTest.java
----------------------------------------------------------------------
diff --cc core/src/test/java/org/apache/brooklyn/util/core/task/ValueResolverTest.java
index c9c76fb,64cb024..6e57c84
--- a/core/src/test/java/org/apache/brooklyn/util/core/task/ValueResolverTest.java
+++ b/core/src/test/java/org/apache/brooklyn/util/core/task/ValueResolverTest.java
@@@ -286,15 -274,57 +290,57 @@@ public class ValueResolverTest extends
});
}
+ public void testTaskFactoryGetImmediatelyDoesNotBlockWithNestedTasks() {
+ final int NUM_CALLS = 3;
+ final AtomicInteger executingCount = new AtomicInteger();
+ final List<SequentialTask<?>> outerTasks = Lists.newArrayList();
+
+ TaskFactory<Task<?>> taskFactory = new TaskFactory<Task<?>>() {
+ @Override public Task<?> newTask() {
+ SequentialTask<?> result = new SequentialTask<>(ImmutableList.of(new Callable<String>() {
+ public String call() {
+ executingCount.incrementAndGet();
+ try {
+ Time.sleep(Duration.ONE_MINUTE);
+ return "myval";
+ } finally {
+ executingCount.decrementAndGet();
+ }
+ }}));
+ outerTasks.add(result);
+ return result;
+ }
+ };
+ for (int i = 0; i < NUM_CALLS; i++) {
+ Maybe<String> result = Tasks.resolving(taskFactory).as(String.class).context(app).immediately(true).getMaybe();
+ Asserts.assertTrue(result.isAbsent(), "result="+result);
+ }
+ // the call below default times out after 30s while the task above is still running
+ Asserts.succeedsEventually(new Runnable() {
+ public void run() {
+ Asserts.assertEquals(outerTasks.size(), NUM_CALLS);
+ for (Task<?> task : outerTasks) {
+ Asserts.assertTrue(task.isDone());
+ Asserts.assertTrue(task.isCancelled());
+ }
+ }
+ });
+ Asserts.succeedsEventually(new Runnable() {
+ public void run() {
+ Asserts.assertEquals(executingCount.get(), 0);
+ }
+ });
+ }
+
private static class MyImmediateAndDeferredSupplier implements ImmediateSupplier<CallInfo>, DeferredSupplier<CallInfo> {
- private final boolean failImmediately;
+ private final RuntimeException failImmediately;
public MyImmediateAndDeferredSupplier() {
- this(false);
+ this(null);
}
- public MyImmediateAndDeferredSupplier(boolean simulateImmediateUnsupported) {
- this.failImmediately = simulateImmediateUnsupported;
+ public MyImmediateAndDeferredSupplier(RuntimeException failImmediately) {
+ this.failImmediately = failImmediately;
}
@Override
[05/11] brooklyn-server git commit: remove commented out and
no-longer needed ValueResolver.execImmediately method
Posted by he...@apache.org.
remove commented out and no-longer needed ValueResolver.execImmediately method
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/ccc80485
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/ccc80485
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/ccc80485
Branch: refs/heads/master
Commit: ccc80485c551dd132763dbc37306b95ca20f240c
Parents: ce094d7
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Fri Mar 3 16:20:17 2017 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Mar 3 16:20:17 2017 +0000
----------------------------------------------------------------------
.../brooklyn/util/core/task/ValueResolver.java | 15 ---------------
1 file changed, 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ccc80485/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java b/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
index c5316fc..e98bb92 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
@@ -562,21 +562,6 @@ public class ValueResolver<T> implements DeferredSupplier<T>, Iterable<Maybe<Obj
}
}
-// /** tries to get immediately, then resolve recursively (including for casting) if {@link #recursive} is set
-// *
-// * @throws InterruptingImmediateSupplier.InterruptingImmediateSupplierNotSupportedForObject
-// * ImmediateSupplier.ImmediateUnsupportedException
-// * if underlying call to {@link ExecutionContext#getImmediately(Object)} does so */
-// protected Maybe<T> execImmediate(ExecutionContext exec, Object immediateSupplierOrImmediateTask) {
-// Maybe<T> result = exec.getImmediately(immediateSupplierOrImmediateTask);
-//
-// return (result.isPresent())
-// ? recursive
-// ? new ValueResolver<T>(result.get(), type, this).getMaybe()
-// : result
-// : result;
-// }
-
protected String getDescription() {
return description!=null ? description : ""+value;
}
[10/11] brooklyn-server git commit: address PR review -- just with
comments here
Posted by he...@apache.org.
address PR review -- just with comments here
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/f4dc19d9
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/f4dc19d9
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/f4dc19d9
Branch: refs/heads/master
Commit: f4dc19d9631801c4472e46367e2c94e12e6446f4
Parents: d4e4107
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Mar 20 15:54:34 2017 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Mar 20 15:54:41 2017 +0000
----------------------------------------------------------------------
.../core/objs/AbstractConfigurationSupportInternal.java | 3 +++
.../org/apache/brooklyn/util/core/task/ValueResolver.java | 7 +++++++
2 files changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f4dc19d9/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java b/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
index 95b6312..4b3876b 100644
--- a/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
+++ b/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
@@ -138,6 +138,9 @@ public abstract class AbstractConfigurationSupportInternal implements BrooklynOb
.context(getContext())
.getMaybe();
if (resolved.isAbsent()) return Maybe.Absent.<T>castAbsent(resolved);
+
+ // likely we don't need this coercion if we set as(key.getType()) above,
+ // but that needs confirmation and quite a lot of testing
return TypeCoercions.tryCoerce(resolved.get(), key.getTypeToken());
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f4dc19d9/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java b/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
index e98bb92..ffaa817 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java
@@ -392,6 +392,13 @@ public class ValueResolver<T> implements DeferredSupplier<T>, Iterable<Maybe<Obj
// (the latter could be tried here, with bailOut false, but in most cases it will just throw so we still need to
// have the timings as in SHORT_WAIT etc as a fallack)
+ // TODO svet suggested at https://github.com/apache/brooklyn-server/pull/565#pullrequestreview-27124074
+ // that we might flip the immediately bit if interrupted -- or maybe instead (alex's idea)
+ // enter this block
+ // if (allowImmediateExecution && (isEvaluatingImmediately() || Thread.isInterrupted())
+ // -- feels right, and would help with some recursive immediate values but no compelling
+ // use case yet and needs some deep thought which we're deferring for now
+
Maybe<T> result = null;
try {
result = exec.getImmediately(v);
[08/11] brooklyn-server git commit: clear interrupt if evaluation a
(nested) ImmediateSupplier
Posted by he...@apache.org.
clear interrupt if evaluation a (nested) ImmediateSupplier
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/d214ca99
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/d214ca99
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/d214ca99
Branch: refs/heads/master
Commit: d214ca99a865707db6d82b5f843c8a921657c886
Parents: ed81635
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Tue Mar 7 15:21:17 2017 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Wed Mar 8 09:30:28 2017 +0000
----------------------------------------------------------------------
.../util/core/task/BasicExecutionContext.java | 9 +++-
.../brooklyn/core/entity/EntityConfigTest.java | 57 +++++++++++++-------
2 files changed, 47 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d214ca99/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionContext.java b/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionContext.java
index f35a68a..6bccf10 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionContext.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionContext.java
@@ -140,7 +140,14 @@ public class BasicExecutionContext extends AbstractExecutionContext {
if (!(callableOrSupplier instanceof ImmediateSupplier)) {
callableOrSupplier = InterruptingImmediateSupplier.of(callableOrSupplier);
}
- return ((ImmediateSupplier<T>)callableOrSupplier).getImmediately();
+ boolean wasAlreadyInterrupted = Thread.interrupted();
+ try {
+ return ((ImmediateSupplier<T>)callableOrSupplier).getImmediately();
+ } finally {
+ if (wasAlreadyInterrupted) {
+ Thread.currentThread().interrupt();
+ }
+ }
} finally {
BasicExecutionManager.getPerThreadCurrentTask().set(previousTask);
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d214ca99/core/src/test/java/org/apache/brooklyn/core/entity/EntityConfigTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/entity/EntityConfigTest.java b/core/src/test/java/org/apache/brooklyn/core/entity/EntityConfigTest.java
index c551ba6..b583b1e 100644
--- a/core/src/test/java/org/apache/brooklyn/core/entity/EntityConfigTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/entity/EntityConfigTest.java
@@ -303,8 +303,13 @@ public class EntityConfigTest extends BrooklynAppUnitTestSupport {
return this;
}
- protected ConfigNonBlockingFixture usingImmediateSupplier() {
- blockingVal = immediateSupplier();
+ protected ConfigNonBlockingFixture usingImmediateSupplierNoSleep() {
+ blockingVal = immediateSupplier(false);
+ return this;
+ }
+
+ protected ConfigNonBlockingFixture usingImmediateSupplierWithSleep() {
+ blockingVal = immediateSupplier(true);
return this;
}
@@ -344,24 +349,18 @@ public class EntityConfigTest extends BrooklynAppUnitTestSupport {
};
}
- private DeferredSupplier<String> immediateSupplier() {
+ private DeferredSupplier<String> immediateSupplier(final boolean withSleep) {
class DeferredImmediateSupplier implements DeferredSupplier<String>, ImmediateSupplier<String> {
@Override
public Maybe<String> getImmediately() {
try {
- // Do a blocking operation (which would cause interrupt, if called in
- // InterruptingImmediateSupplier). This is to simulate use-cases like
- // use of `$brooklyn:external("vault", "aws.secretKey")`, which is not
- // blocked by other Brooklyn tasks, but will do IO operations.
- Thread.sleep(1);
+ sleepIfNeeded();
log.trace("acquiring");
if (latch.tryAcquire()) {
latch.release();
return Maybe.of("myval");
} else {
- // TODO After Alex's changes in PR #565, use:
- // Maybe.absent(new ImmediateSupplier.ImmediateValueNotAvailableException()));
- return Maybe.absent();
+ return Maybe.absent(new ImmediateSupplier.ImmediateValueNotAvailableException());
}
} catch (InterruptedException e) {
log.trace("interrupted");
@@ -370,7 +369,7 @@ public class EntityConfigTest extends BrooklynAppUnitTestSupport {
}
@Override public String get() {
try {
- Thread.sleep(1); // See explanation in getImmediately()
+ sleepIfNeeded();
log.trace("acquiring");
if (!latch.tryAcquire()) latch.acquire();
latch.release();
@@ -381,6 +380,20 @@ public class EntityConfigTest extends BrooklynAppUnitTestSupport {
}
return "myval";
}
+ private void sleepIfNeeded() throws InterruptedException {
+ if (withSleep) {
+ try {
+ // Do a blocking operation (which would cause interrupt, if called in
+ // InterruptingImmediateSupplier). This is to simulate use-cases like
+ // use of `$brooklyn:external("vault", "aws.secretKey")`, which is not
+ // blocked by other Brooklyn tasks, but will do IO operations.
+ Thread.sleep(1);
+ } catch (InterruptedException e) {
+ log.debug("Sleep was interrupted during eval (expected in many cases)", e);
+ throw Exceptions.propagate(e);
+ }
+ }
+ }
}
return new DeferredImmediateSupplier();
}
@@ -487,7 +500,7 @@ public class EntityConfigTest extends BrooklynAppUnitTestSupport {
new ConfigNonBlockingFixture().usingDeferredSupplier().runGetConfigNonBlockingInMap();
}
- @Test // fast
+ @Test
public void testGetInterruptingImmediateSupplierNonBlockingKey() throws Exception {
new ConfigNonBlockingFixture().usingInterruptingImmediateSupplier().runGetConfigNonBlockingInKey();
}
@@ -496,13 +509,21 @@ public class EntityConfigTest extends BrooklynAppUnitTestSupport {
new ConfigNonBlockingFixture().usingInterruptingImmediateSupplier().runGetConfigNonBlockingInMap();
}
- @Test // fast
- public void testGetImmediateSupplierNonBlockingKey() throws Exception {
- new ConfigNonBlockingFixture().usingImmediateSupplier().runGetConfigNonBlockingInKey();
+ @Test
+ public void testGetImmediateSupplierNoSleepNonBlockingKey() throws Exception {
+ new ConfigNonBlockingFixture().usingImmediateSupplierNoSleep().runGetConfigNonBlockingInKey();
+ }
+ @Test
+ public void testGetImmediateSupplierNoSleepNonBlockingMap() throws Exception {
+ new ConfigNonBlockingFixture().usingImmediateSupplierNoSleep().runGetConfigNonBlockingInMap();
+ }
+ @Test
+ public void testGetImmediateSupplierWithSleepNonBlockingKey() throws Exception {
+ new ConfigNonBlockingFixture().usingImmediateSupplierWithSleep().runGetConfigNonBlockingInKey();
}
@Test
- public void testGetImmediateSupplierNonBlockingMap() throws Exception {
- new ConfigNonBlockingFixture().usingImmediateSupplier().runGetConfigNonBlockingInMap();
+ public void testGetImmediateSupplierWithSleepNonBlockingMap() throws Exception {
+ new ConfigNonBlockingFixture().usingImmediateSupplierWithSleep().runGetConfigNonBlockingInMap();
}
@Test
[06/11] brooklyn-server git commit: Merge branch 'master' into
config-immediate-more
Posted by he...@apache.org.
Merge branch 'master' into config-immediate-more
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/1744145b
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/1744145b
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/1744145b
Branch: refs/heads/master
Commit: 1744145b6091158bf64dda92831e88fe0cc9cc32
Parents: ccc8048 2fe2ba0
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Tue Mar 7 12:13:58 2017 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Tue Mar 7 12:13:58 2017 +0000
----------------------------------------------------------------------
.../brooklyn/core/entity/EntityConfigTest.java | 60 +++++++++++++++++++-
.../org/apache/brooklyn/rest/api/LogoutApi.java | 7 +++
.../brooklyn/rest/resources/LogoutResource.java | 7 +++
.../resources/OSGI-INF/blueprint/service.xml | 1 +
4 files changed, 74 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/1744145b/core/src/test/java/org/apache/brooklyn/core/entity/EntityConfigTest.java
----------------------------------------------------------------------
[03/11] brooklyn-server git commit: Merge branch 'master' into
config-immediate-more
Posted by he...@apache.org.
Merge branch 'master' into config-immediate-more
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b61b46ed
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b61b46ed
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b61b46ed
Branch: refs/heads/master
Commit: b61b46ede0651605a282ff08a5eac91c9c81c13c
Parents: 3821e02 fa7c38b
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Mar 1 12:12:23 2017 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Wed Mar 1 12:12:23 2017 +0000
----------------------------------------------------------------------
LICENSE | 8 +-
.../brooklyn/api/catalog/CatalogItem.java | 6 +
.../brooklyn/api/mgmt/ManagementContext.java | 15 +
.../apache/brooklyn/api/mgmt/Scratchpad.java | 27 +
.../camp/brooklyn/BrooklynCampPlatform.java | 6 +-
.../brooklyn/spi/creation/CampResolver.java | 3 +
.../methods/FormatStringIntegrationTest.java | 76 ++
.../camp/brooklyn/ExternalConfigYamlTest.java | 2 +-
.../brooklyn/ReloadBrooklynPropertiesTest.java | 6 +-
.../catalog/CatalogMakeOsgiBundleTest.java | 201 ++++
.../catalog/GetFileContentsEffector.java | 46 +
.../lite/CampPlatformWithJustBrooklynMgmt.java | 2 +
.../osgi/catalog-bundle-1/META-INF/MANIFEST.MF | 3 +
.../catalog/osgi/catalog-bundle-1/catalog.bom | 31 +
core/pom.xml | 10 +
.../core/BrooklynFeatureEnablement.java | 2 +-
.../catalog/internal/BasicBrooklynCatalog.java | 2 +-
.../catalog/internal/CatalogBomScanner.java | 72 +-
.../core/entity/AbstractApplication.java | 51 +-
.../location/cloud/CloudLocationConfig.java | 23 +-
.../brooklyn/core/mgmt/BrooklynTaskTags.java | 2 +
.../JavaBrooklynClassLoadingContext.java | 6 +-
.../internal/AbstractManagementContext.java | 8 +
.../core/mgmt/internal/BasicScratchpad.java | 43 +
.../internal/DeferredBrooklynProperties.java | 2 +-
.../mgmt/internal/LocalSubscriptionManager.java | 147 +--
.../NonDeploymentManagementContext.java | 7 +
.../brooklyn/core/mgmt/usage/LocationUsage.java | 8 +-
.../brooklyn/util/core/osgi/BundleMaker.java | 353 +++++++
.../brooklyn/util/core/task/BasicTask.java | 4 +-
.../entity/ApplicationLifecycleStateTest.java | 16 +
.../LocalManagementContextRebindTest.java | 38 +
.../internal/LocalManagementContextTest.java | 20 +-
.../util/core/osgi/BundleMakerTest.java | 270 ++++++
.../osgi/test/bundlemaker/nomanifest/myfile.txt | 1 +
.../bundlemaker/nomanifest/subdir/myfile2.txt | 1 +
.../withmanifest/META-INF/MANIFEST.MF | 2 +
.../test/bundlemaker/withmanifest/myfile.txt | 1 +
.../bundlemaker/withmanifest/subdir/myfile2.txt | 1 +
.../brooklyn/launcher/osgi/OsgiLauncher.java | 4 +
.../location/jclouds/ConnectivityResolver.java | 55 ++
.../jclouds/ConnectivityResolverOptions.java | 245 +++++
.../jclouds/DefaultConnectivityResolver.java | 490 ++++++++++
.../location/jclouds/JcloudsLocation.java | 389 ++++----
.../location/jclouds/JcloudsLocationConfig.java | 4 +
.../jclouds/JcloudsSshMachineLocation.java | 2 +-
.../brooklyn/location/jclouds/JcloudsUtil.java | 1 -
.../jclouds/ManagementAddressResolveResult.java | 54 ++
.../jclouds/AbstractJcloudsStubbedLiveTest.java | 3 +-
...BasicLocationNetworkInfoInitializerTest.java | 44 +
.../DefaultConnectivityResolverTest.java | 262 ++++++
...dsByonLocationResolverStubbedRebindTest.java | 2 +
.../JcloudsReachableAddressStubbedTest.java | 69 +-
.../rest/domain/CatalogEntitySummary.java | 3 +-
.../rest/domain/CatalogItemSummary.java | 12 +-
.../rest/domain/CatalogLocationSummary.java | 3 +-
.../rest/domain/CatalogPolicySummary.java | 3 +-
.../rest/security/jaas/BrooklynLoginModule.java | 2 +
.../provider/DelegatingSecurityProvider.java | 6 +-
.../rest/transform/CatalogTransformer.java | 8 +-
.../util/json/BrooklynJacksonJsonProvider.java | 4 +-
.../filter/EntitlementContextFilterTest.java | 2 +-
server-cli/src/main/license/files/LICENSE | 13 +
.../src/main/license/source-inclusions.yaml | 3 +
.../main/resources/brooklyn/default.catalog.bom | 4 +
.../main/resources/brooklyn/icons/cluster.svg | 1 +
.../main/resources/brooklyn/icons/server.svg | 933 +++++++++++++++++++
.../MachineLifecycleEffectorTasks.java | 16 +-
.../brooklyn/entity/AbstractEc2LiveTest.java | 17 -
.../util/net/ReachableSocketFinder.java | 107 +--
.../util/net/ReachableSocketFinderTest.java | 42 +-
71 files changed, 3823 insertions(+), 502 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b61b46ed/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTaskTags.java
----------------------------------------------------------------------
[09/11] brooklyn-server git commit: Merge branch 'master' into
config-immediate-more
Posted by he...@apache.org.
Merge branch 'master' into config-immediate-more
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/d4e41074
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/d4e41074
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/d4e41074
Branch: refs/heads/master
Commit: d4e410749d9c938daf21ce8540de6038cc34e45e
Parents: d214ca9 a0f8840
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Mar 20 15:41:30 2017 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Mar 20 15:41:30 2017 +0000
----------------------------------------------------------------------
.../internal/AbstractBrooklynObjectSpec.java | 10 +-
.../spi/dsl/methods/BrooklynDslCommon.java | 12 +-
.../brooklyn/spi/dsl/methods/DslComponent.java | 5 +
.../camp/brooklyn/ConfigParametersYamlTest.java | 97 +++++++
.../brooklyn/camp/brooklyn/ObjectsYamlTest.java | 119 ++++++++
.../camp/brooklyn/WindowsYamlLiveTest.java | 12 +-
.../catalog/CatalogOsgiLibraryTest.java | 119 ++++++++
.../camp/brooklyn/rebind/RebindDslTest.java | 180 +++++++++++++
.../rebind/dsl-2016-07-entity-klcueb1ide | 58 ++++
core/pom.xml | 12 +-
.../core/catalog/internal/CatalogUtils.java | 1 +
.../core/enricher/AbstractEnricher.java | 5 +-
.../apache/brooklyn/core/entity/Entities.java | 42 +--
.../brooklyn/core/entity/EntityPredicates.java | 17 ++
.../core/mgmt/persist/OsgiClassPrefixer.java | 2 +-
.../core/objs/AbstractBrooklynObject.java | 19 +-
.../core/objs/proxy/InternalEntityFactory.java | 10 +-
.../enricher/stock/AbstractAggregator.java | 44 +--
.../enricher/stock/AbstractTransformer.java | 9 +-
.../brooklyn/enricher/stock/Aggregator.java | 24 +-
.../apache/brooklyn/enricher/stock/Joiner.java | 33 ++-
.../brooklyn/enricher/stock/Propagator.java | 16 +-
.../brooklyn/enricher/stock/Transformer.java | 9 +-
.../enricher/stock/reducer/Reducer.java | 22 +-
.../apache/brooklyn/feed/CommandPollConfig.java | 16 +-
.../apache/brooklyn/feed/ssh/SshPollConfig.java | 43 +++
.../WindowsPerformanceCounterPollConfig.java | 61 -----
.../brooklyn/util/core/ClassLoaderUtils.java | 33 ++-
.../brooklyn/util/core/flags/TypeCoercions.java | 14 +
.../util/core/xstream/ClassRenamingMapper.java | 144 +++++++++-
.../ObjectWithDefaultStringImplConverter.java | 89 ++++++
.../util/core/xstream/XmlSerializer.java | 13 +-
.../deserializingClassRenames.properties | 4 +-
.../brooklyn/core/entity/EntitiesTest.java | 20 +-
.../mgmt/persist/XmlMementoSerializerTest.java | 99 ++++++-
.../mgmt/rebind/RebindHistoricSshFeedTest.java | 95 +++++++
.../util/core/xstream/XmlSerializerTest.java | 134 ++++++++++
.../ssh-feed-no-bundle-prefixes-zv7t8bim62 | 268 +++++++++++++++++++
.../core/mgmt/rebind/ssh-feed-zv7t8bim62 | 268 +++++++++++++++++++
karaf/features/src/main/feature/feature.xml | 4 +-
.../Windows7zipBlueprintLiveTest.java | 4 +-
launcher/src/test/resources/install7zip.ps1 | 13 +-
locations/jclouds/pom.xml | 2 +-
.../jclouds/DefaultConnectivityResolver.java | 7 +-
.../location/jclouds/JcloudsLocation.java | 1 +
.../jclouds/BailOutJcloudsLocation.java | 12 +-
.../location/jclouds/JcloudsSshingLiveTest.java | 1 +
parent/pom.xml | 11 +-
pom.xml | 19 +-
rest/rest-api/pom.xml | 10 +-
.../BrooklynRestApiLauncherTestFixture.java | 2 +-
.../AbstractRestApiEntitlementsTest.java | 7 +
.../org/apache/brooklyn/cli/AbstractMain.java | 20 +-
.../org/apache/brooklyn/cli/CloudExplorer.java | 8 +-
.../org/apache/brooklyn/cli/ItemLister.java | 24 +-
.../main/java/org/apache/brooklyn/cli/Main.java | 30 +--
.../java/org/apache/brooklyn/cli/CliTest.java | 6 +-
.../brooklyn/cli/CloudExplorerLiveTest.java | 4 +-
...laWindowsProcessWinrmExitStatusLiveTest.java | 6 +-
.../MachineLifecycleEffectorTasksTest.java | 11 +-
.../lifecycle/WinRmExecuteHelperUnitTest.java | 5 +-
.../core/sensor/windows/WinRmCommandSensor.java | 16 +-
.../WindowsPerformanceCounterPollConfig.java | 61 +++++
.../location/winrm/WinRmMachineLocation.java | 4 +
.../internal/winrm/winrm4j/Winrm4jTool.java | 50 +++-
.../brooklyn/test/framework/TestHttpCall.java | 6 +
.../test/framework/TestHttpCallImpl.java | 7 +-
.../test/framework/TestHttpCallTest.java | 26 ++
.../org/apache/brooklyn/test/LogWatcher.java | 2 +-
.../apache/brooklyn/util/guava/Functionals.java | 12 +
.../brooklyn/util/javalang/Reflections.java | 77 +++++-
.../coerce/CommonAdaptorTypeCoercions.java | 19 ++
.../brooklyn/util/guava/FunctionalsTest.java | 13 +-
.../brooklyn/util/javalang/ReflectionsTest.java | 21 +-
.../util/javalang/coerce/TypeCoercionsTest.java | 13 +
75 files changed, 2394 insertions(+), 318 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d4e41074/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d4e41074/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
----------------------------------------------------------------------
[07/11] brooklyn-server git commit: remove unnecessary marker default
value
Posted by he...@apache.org.
remove unnecessary marker default value
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/ed81635e
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/ed81635e
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/ed81635e
Branch: refs/heads/master
Commit: ed81635e3d4f85bf5d9bf978447d50080140e7e8
Parents: 1744145
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Tue Mar 7 15:20:42 2017 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Tue Mar 7 15:20:42 2017 +0000
----------------------------------------------------------------------
.../core/objs/AbstractConfigurationSupportInternal.java | 6 ------
1 file changed, 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ed81635e/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java b/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
index 113daac..95b6312 100644
--- a/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
+++ b/core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
@@ -131,19 +131,13 @@ public abstract class AbstractConfigurationSupportInternal implements BrooklynOb
// getRaw returns Maybe(val) if the key was explicitly set (where val can be null)
// or Absent if the config key was unset.
Object unresolved = getRaw(key).or(key.getDefaultValue());
- final Object marker = new Object();
Maybe<Object> resolved = Tasks.resolving(unresolved)
.as(Object.class)
- .defaultValue(marker)
.immediately(true)
.deep(true)
.context(getContext())
.getMaybe();
if (resolved.isAbsent()) return Maybe.Absent.<T>castAbsent(resolved);
- if (resolved.get()==marker) {
- // TODO changed Feb 2017, previously returned absent, in contrast to what the javadoc says
- return Maybe.of((T)null);
- }
return TypeCoercions.tryCoerce(resolved.get(), key.getTypeToken());
}
[11/11] brooklyn-server git commit: This closes #565
Posted by he...@apache.org.
This closes #565
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/afe274fc
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/afe274fc
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/afe274fc
Branch: refs/heads/master
Commit: afe274fcb322e28b5e91c52a02cfc35d94fafe50
Parents: a0f8840 f4dc19d
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Mar 20 15:57:03 2017 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Mar 20 15:57:03 2017 +0000
----------------------------------------------------------------------
.../spi/dsl/DslDeferredFunctionCall.java | 3 +-
.../spi/dsl/methods/BrooklynDslCommon.java | 15 +---
.../brooklyn/spi/dsl/methods/DslComponent.java | 10 +--
.../brooklyn/camp/brooklyn/ConfigYamlTest.java | 40 ++-------
.../config/internal/AbstractConfigMapImpl.java | 3 +
.../AbstractConfigurationSupportInternal.java | 58 ++++++-------
.../core/objs/BrooklynObjectInternal.java | 13 ++-
.../core/sensor/DependentConfiguration.java | 15 ++--
.../util/core/task/BasicExecutionContext.java | 9 +-
.../util/core/task/ImmediateSupplier.java | 43 +++++++++-
.../task/InterruptingImmediateSupplier.java | 7 +-
.../brooklyn/util/core/task/ValueResolver.java | 86 +++++++++-----------
.../brooklyn/core/entity/EntityConfigTest.java | 75 +++++++++++------
.../util/core/task/ValueResolverTest.java | 34 ++++++--
.../org/apache/brooklyn/util/guava/Maybe.java | 9 ++
15 files changed, 240 insertions(+), 180 deletions(-)
----------------------------------------------------------------------