brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #833: Fix PeriodicEffectorPolicy
Date Wed, 20 Sep 2017 11:01:21 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/833#discussion_r139937923
  
    --- Diff: policy/src/main/java/org/apache/brooklyn/policy/action/AbstractScheduledEffectorPolicy.java
---
    @@ -101,15 +102,15 @@
     
         public static final ConfigKey<Boolean> RUNNING = ConfigKeys.builder(Boolean.class)
                 .name("running")
    -            .description("Set if the executor has started")
    +            .description("[INTERNAL] Set if the executor has started")
                 .defaultValue(Boolean.FALSE)
                 .reconfigurable(true)
                 .build();
     
         public static final ConfigKey<List<Long>> SCHEDULED = ConfigKeys.builder(new
TypeToken<List<Long>>() { })
                 .name("scheduled")
                 .description("List of all scheduled execution start times")
    -            .defaultValue(Lists.newCopyOnWriteArrayList())
    +            .defaultValue(ImmutableList.of())
    --- End diff --
    
    If you set the defaultValue to something mutable, then if two different policy instances
retrieve and modify it, they'll see each other's changes!
    
    And yes, because we're modifying a copy we can use the non-COW version.


---

Mime
View raw message