[ 
https://issues.apache.org/jira/browse/BROOKLYN-259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15276395#comment-15276395
 ] 

ASF GitHub Bot commented on BROOKLYN-259:
-----------------------------------------

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

    https://github.com/apache/brooklyn-server/pull/132#discussion_r62502931
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/location/byon/FixedListMachineProvisioningLocation.java
 ---
    @@ -103,10 +105,29 @@
         @Beta
         @SuppressWarnings("serial")
         public static final ConfigKey<List<LocationSpec<? extends 
MachineLocation>>> MACHINE_SPECS = ConfigKeys.newConfigKey(
    -                    new TypeToken<List<LocationSpec<? extends 
MachineLocation>>>() {}, 
    -                    "byon.machineSpecs",
    -                    "Specs of machines that should be immediatly 
instantiated on init",
    -                    ImmutableList.<LocationSpec<? extends 
MachineLocation>>of());
    +            new TypeToken<List<LocationSpec<? extends MachineLocation>>>() 
{}, 
    +            "byon.machineSpecs",
    +            "Specs of machines that should be immediatly instantiated on 
init",
    +            ImmutableList.<LocationSpec<? extends MachineLocation>>of());
    +
    +    /**
    +     * The initialMachinesFactory allows {@code 
JcloudsByonLocationResolver} to work, to defer 
    +     * instantiating the {@code JcloudsLocation} and the {@code 
JcloudsMachineLocation} instances.
    +     * (Important because the caller might not use the spec and thus might 
not unmanage the machine 
    +     * instances).
    +     * 
    +     * We clear the initialMachinesFactory in init, so they will never be 
persisted. This will help 
    +     * with backwards compatibility if we change how this is done.
    +     * 
    +     * By the end of init(), the {@link #machines} will contain the full 
list of locations.
    +     */
    +    @Beta
    +    @SuppressWarnings("serial")
    +    public static final ConfigKey<Supplier<? extends List<? extends 
MachineLocation>>> INITIAL_MACHINES_FACTORY = ConfigKeys.newConfigKey(
    +            new TypeToken<Supplier<? extends List<? extends 
MachineLocation>>>() {}, 
    +            "byon.initialMachinesFactory",
    +            "Factory for creating the machines that should be immediatly 
instantiated on init",
    --- End diff --
    
    `immediatly`


> jcloudsByon location spec leaks location instances
> --------------------------------------------------
>
>                 Key: BROOKLYN-259
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-259
>             Project: Brooklyn
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Aled Sage
>             Fix For: 0.10.0
>
>
> When declaring in brooklyn.properties a location spec such as 
> {noformat}
> jcloudsByon(provider="aws-ec2",region="us-east-1",user="brooklyn",password="pa55w0rd",hosts="i-12345678")
> {noformat}
> It caused new locations to be created and persisted every few seconds, but 
> for those locations to be never deleted.
> ---
> This was caused by changes made in 0.9.0 to {{LocationResolver}} 
> implementations, so that it creates a {{LocationSpec}} rather than 
> instantiating a location directly. Unfortunately, 
> {{JcloudsByonLocationResolver}} had not been updated. The REST api would poll 
> this regularly to find out about the types of location, and on every poll it 
> would create new locations.
> This is similar to the problem encountered for localhost, fixed in time for 
> 0.9.0 in https://github.com/apache/brooklyn-server/pull/97.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to