brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (BROOKLYN-143) Add support for Hazelcast
Date Mon, 18 May 2015 09:49:00 GMT

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

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

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

    https://github.com/apache/incubator-brooklyn/pull/642#discussion_r30493993
  
    --- Diff: sandbox/nosql/src/main/java/brooklyn/entity/nosql/hazelcast/HazelcastNodeSshDriver.java
---
    @@ -0,0 +1,112 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package brooklyn.entity.nosql.hazelcast;
    +
    +import static java.lang.String.format;
    +import java.util.List;
    +import brooklyn.entity.basic.AbstractSoftwareProcessSshDriver;
    +import brooklyn.entity.basic.Entities;
    +import brooklyn.entity.basic.EntityLocal;
    +import brooklyn.location.basic.SshMachineLocation;
    +import brooklyn.util.collections.MutableMap;
    +import brooklyn.util.os.Os;
    +import brooklyn.util.ssh.BashCommands;
    +
    +import com.google.common.collect.ImmutableList;
    +
    +public class HazelcastNodeSshDriver extends AbstractSoftwareProcessSshDriver implements
HazelcastNodeDriver {
    +
    +    public HazelcastNodeSshDriver(EntityLocal entity, SshMachineLocation machine) {
    +        super(entity, machine);
    +    }
    +
    +    @Override
    +    public void preInstall() {
    +        resolver = Entities.newDownloader(this);
    +    }
    +
    +    @Override
    +    public void install() {
    +        List<String> urls = resolver.getTargets();
    +        String saveAs = resolver.getFilename();
    +        
    +        List<String> commands = ImmutableList.<String>builder()
    +            .add(BashCommands.installJavaLatestOrWarn())
    +            .addAll(BashCommands.commandsToDownloadUrlsAs(urls, saveAs))
    +            .build();
    +        
    +        newScript(INSTALLING).body.append(commands).execute();
    +    }
    +
    +    @Override
    +    public void customize() {
    +
    +    	ImmutableList.Builder<String> commands = new ImmutableList.Builder<String>()
    +                .add("mkdir -p lib conf log")
    +                .add(String.format("cp %s/%s %s/lib/", getInstallDir(), resolver.getFilename(),
getRunDir()));
    +
    +        newScript(CUSTOMIZING)
    +                .body.append(commands.build())
    +                .failOnNonZeroResultCode()
    +                .execute();
    +        
    +        copyTemplate(entity.getConfig(HazelcastNode.TEMPLATE_CONFIGURATION_URL), Os.mergePaths(getRunDir(),
"conf", getConfigFile()));
    +        
    +    }
    +
    +    @Override
    +    public void launch() {
    +        
    +        entity.setAttribute(HazelcastNode.PID_FILE, Os.mergePathsUnix(getRunDir(), PID_FILENAME));
    +        
    +        StringBuilder commandBuilder = new StringBuilder()
    +            .append(format("nohup java -cp ./lib/hazelcast-%s.jar", getVersion()));
    --- End diff --
    
    I see you've followed the same pattern as elsewhere for setting the `resolver` field in
the superclass. However, I think that might be a (subtly) bad pattern. If we stop and restart
Brooklyn, then it restores the entities based on their config+attributes, and calling `rebind()`.
I don't think anything will re-set the `resolver` field in the driver.
    
    I suggest you don't worry about that in your pull request. We should refactor + fix that
across the board (probably in the super-class) in a separate pull request, rather than doing
something specific for hazelcast.


> Add support for Hazelcast
> -------------------------
>
>                 Key: BROOKLYN-143
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-143
>             Project: Brooklyn
>          Issue Type: New Feature
>            Reporter: Yavor Yanchev
>            Priority: Minor
>
> Hazelcast is a clustering and highly scalable data distribution platform for Java.
> Some of the features it provides
> Distributed java.util.{Queue, Set, List, Map}
> Distributed java.util.concurrency.locks.Lock
> Distributed java.util.concurrent.ExecutorService
> Distributed Indexing and Query support



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

Mime
View raw message