You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by neykov <gi...@git.apache.org> on 2014/09/05 21:18:55 UTC

[GitHub] incubator-brooklyn pull request: Start mirroring remote entities a...

GitHub user neykov opened a pull request:

    https://github.com/apache/incubator-brooklyn/pull/150

    Start mirroring remote entities asynchronously.

    The MIRRORED_ENTITY_URL could be a task instead of a plain property which would block on an attempt to access it. Instead of potentially blocking .init() create a task to start the mirroring as soon as the property is accessible.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/neykov/incubator-brooklyn async-mirror-entity

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-brooklyn/pull/150.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #150
    
----
commit cfd54d47a784841f4452842f59a07109b06868e5
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Date:   2014-09-05T19:12:42Z

    Start mirroring remote entities asynchronously.
    
    The MIRRORED_ENTITY_URL could be a task instead of a plain property which could block on an attempt to access it. Instead of potentially blocking .init() create a task to start the mirroring as soon as the property is accessible.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Start mirroring remote entities a...

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/150#issuecomment-54950024
  
    LGTM, good concern, and good idea for working around it.  feels better than the previous, though it might still have issues, so we should keep an eye on this approach.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Start mirroring remote entities a...

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/150#issuecomment-54683772
  
    Looks sensible. Only the one question about `setExpectedState`, then I'm happy to merge.
    
    It's a general concern if we're going to do more in `init` (e.g. calling `connectSensors()` from inside `init` for more entities) if that might access config and thus block. If we're going to do that, is the `connectSensorsAsync` the right general approach or should we call it from elsewhere? The reason for doing it in `init` is because the enrichers+policies it creates will be persisted, so we don't want to it to be done again on rebind. However, if it was `async` then it might not have been done at all (e.g. if the config was taking a long time to be set). Worth more thought for what our general approach is for this before we use it in lots of other places, I think.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Start mirroring remote entities a...

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/150#discussion_r17198868
  
    --- Diff: software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynEntityMirrorImpl.java ---
    @@ -70,10 +74,34 @@ protected void initEnrichers() {}
         @Override
         public void init() {
             super.init();
    -        connectSensors();
    +        connectSensorsAsync();
    +
    +        //start spinning, could take some time before MIRRORED_ENTITY_URL is available for first time mirroring
    +        ServiceStateLogic.setExpectedState(this, Lifecycle.STARTING);
    --- End diff --
    
    What sets the expected state to `Lifecycle.RUNNING`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Start mirroring remote entities a...

Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/150#discussion_r17233437
  
    --- Diff: software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynEntityMirrorImpl.java ---
    @@ -70,10 +74,34 @@ protected void initEnrichers() {}
         @Override
         public void init() {
             super.init();
    -        connectSensors();
    +        connectSensorsAsync();
    +
    +        //start spinning, could take some time before MIRRORED_ENTITY_URL is available for first time mirroring
    +        ServiceStateLogic.setExpectedState(this, Lifecycle.STARTING);
    --- End diff --
    
    The entity will mirror all the sensors from the remote entity including the SERVICE_STATE_ACTUAL value. It will change to RUNNING as soon as the remote entity is RUNNING.
    
    The line changed a bit after testing (directly setting SERVICE_STATE_ACTUAL instead of _EXPECTED), but the question is still valid.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Start mirroring remote entities a...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-brooklyn/pull/150


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---