Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/917#discussion_r158293220
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java ---
    @@ -749,13 +756,15 @@ public Application getApplication() {
         // FIXME Can this really be deleted? Overridden by 
AbstractApplication; needs careful review
         /** @deprecated since 0.4.0 should not be needed / leaked outwith 
brooklyn internals / mgmt support? */
         @Deprecated
    -    protected synchronized void setApplication(Application app) {
    -        if (application != null) {
    -            if (application.getId() != app.getId()) {
    -                throw new IllegalStateException("Cannot change application 
of entity (attempted for "+this+" from "+getApplication()+" to "+app);
    +    protected void setApplication(Application app) {
    +        synchronized (appMutex) {
    --- End diff --
    
    We don't ever want an entity-author to call `setApplication`, so I think 
I'm ok leaving it deprecated. Not sure what we should do long term to hide this 
away somewhere in framework code so that users don't accidentally call it or 
get confused by it.
    
    The use of `FIXME` is too strong; I'll change it to a `TODO` - it's low 
priority as it does work, it's just ugly.
    
    ---
    For where to put the synchronized, I think it needs to be here.


---

Reply via email to