Skip to content

BROOKLYN-273: restart() calls pre-launch & post-launch#149

Merged
asfgit merged 3 commits intoapache:masterfrom
aledsage:BROOKLYN-273
May 24, 2016
Merged

BROOKLYN-273: restart() calls pre-launch & post-launch#149
asfgit merged 3 commits intoapache:masterfrom
aledsage:BROOKLYN-273

Conversation

@aledsage
Copy link
Copy Markdown
Contributor

No description provided.

aledsage added 3 commits May 20, 2016 18:05
Previously for MapConfigKey, the getNonBlocking would always return
null. This could badly impacted VanillaSoftwareProcess, where 
`VanillaSoftwareProcessSshDriver.getInstallLabelExtraSalt` would call
this for SHELL_ENVIRONMENT. The shell env was therefore not included
in the hash.
Previously if download-url or install-command was blank, it would
not continue to look at shell-env for computing the salt for the 
install dir.
public <T> Maybe<T> getNonBlocking(ConfigKey<T> key) {
public <T> Maybe<T> getNonBlocking(final ConfigKey<T> key) {
if (key instanceof StructuredConfigKey || key instanceof SubElementConfigKey) {
return getNonBlockingResolvingStructuredKey(key);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use this implementation for both cases to simplify.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neykov I wondered about using the same impl, but the problem is getNonBlockingResolvingStructuredKey isn't a great implementation. If the thread executing the resolving task is starved, then it could timeout even though the underlying task was not blocked. In contrast, the other code-path will first check if the value needs resolved in a special way. If it does not, it will just return the value directly. It is therefore more reliable!

@neykov
Copy link
Copy Markdown
Member

neykov commented May 24, 2016

LGTM, merging

@asfgit asfgit merged commit 8ab5dad into apache:master May 24, 2016
asfgit pushed a commit that referenced this pull request May 24, 2016
BROOKLYN-273: restart() calls pre-launch & post-launch
@sjcorbett
Copy link
Copy Markdown
Contributor

@aledsage @neykov EntityConfigTest.testGetConfigNonBlocking added in 8bfff16 is failing the build.

java.lang.IllegalArgumentException: Error resolving config test.confMapThing.obj.mysub, Task[DstJob:XKK7POv1;[Wrapped[contextEntity:TestEntityImpl{id=B8ulGFpH}], LocalManagementContext[SMAARkex-UbwQsOE8], TRANSIENT]]@XKK7POv1, in org.apache.brooklyn.util.core.task.BasicExecutionContext@76b7ae1([Wrapped[contextEntity:TestEntityImpl{id=B8ulGFpH}], LocalManagementContext[SMAARkex-UbwQsOE8]]): java.util.concurrent.CancellationException
    at org.apache.brooklyn.util.core.task.ValueResolver.getMaybeInternal(ValueResolver.java:411)
    at org.apache.brooklyn.util.core.task.ValueResolver.getMaybe(ValueResolver.java:257)
    at org.apache.brooklyn.util.core.task.ValueResolver.get(ValueResolver.java:250)
    at org.apache.brooklyn.util.core.task.Tasks.resolveValue(Tasks.java:139)
    at org.apache.brooklyn.core.config.BasicConfigKey.resolveValue(BasicConfigKey.java:294)
    at org.apache.brooklyn.core.config.BasicConfigKey.extractValue(BasicConfigKey.java:279)
    at org.apache.brooklyn.core.config.SubElementConfigKey.extractValue(SubElementConfigKey.java:48)
    at org.apache.brooklyn.core.config.internal.AbstractStructuredConfigKey.extractValue(AbstractStructuredConfigKey.java:111)
    at org.apache.brooklyn.core.config.internal.AbstractStructuredConfigKey.extractValue(AbstractStructuredConfigKey.java:124)
    at org.apache.brooklyn.core.entity.internal.EntityConfigMap.getConfig(EntityConfigMap.java:118)
    at org.apache.brooklyn.core.config.internal.AbstractConfigMapImpl.getConfig(AbstractConfigMapImpl.java:50)
    at org.apache.brooklyn.core.entity.AbstractEntity$BasicConfigurationSupport.get(AbstractEntity.java:1180)
    at org.apache.brooklyn.core.entity.EntityConfigTest.testGetConfigNonBlocking(EntityConfigTest.java:208)
Caused by: java.util.concurrent.CancellationException
    at org.apache.brooklyn.util.core.task.BasicTask.blockUntilStarted(BasicTask.java:385)
    at org.apache.brooklyn.util.core.task.BasicTask.blockUntilStarted(BasicTask.java:378)
    at org.apache.brooklyn.util.core.task.BasicTask.get(BasicTask.java:360)
    at org.apache.brooklyn.util.core.task.ValueResolver.getMaybeInternal(ValueResolver.java:319)
    ... 40 more
... Removed 28 stack frames

@aledsage aledsage deleted the BROOKLYN-273 branch May 31, 2016 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants