diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-07-14 10:56:18 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-07-14 10:56:31 +0200 |
commit | 9a55c20b4fa5ea3082decc45614c79630f0b38e1 (patch) | |
tree | d50b0ef8d92b35ab201394ad4d46183e46383fa1 /server/sonar-search | |
parent | e54940fd9ea100740082939b9a28157d3803d462 (diff) | |
download | sonarqube-9a55c20b4fa5ea3082decc45614c79630f0b38e1.tar.gz sonarqube-9a55c20b4fa5ea3082decc45614c79630f0b38e1.zip |
Elasticsearch : disable multicast discovery of Elasticsearch (typo in property)
and remove dependencies on logback and commons-io
Diffstat (limited to 'server/sonar-search')
5 files changed, 63 insertions, 42 deletions
diff --git a/server/sonar-search/pom.xml b/server/sonar-search/pom.xml index a5b6e7fc936..f9803aa76a9 100644 --- a/server/sonar-search/pom.xml +++ b/server/sonar-search/pom.xml @@ -13,33 +13,25 @@ <artifactId>sonar-search</artifactId> <packaging>jar</packaging> <name>SonarQube :: Search</name> - <description>Elasticsearch Wrapper</description> + <description>Wrapper to start Elasticsearch</description> <dependencies> <dependency> <groupId>org.codehaus.sonar</groupId> <artifactId>sonar-process</artifactId> - <version>${project.version}</version> + <version>${pom.version}</version> </dependency> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> </dependency> <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + <scope>provided</scope> </dependency> + <!-- testing --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -75,9 +67,9 @@ </execution> </executions> <configuration> - <finalName>${artifactId}-${version}</finalName> + <finalName>${pom.artifactId}-${pom.version}</finalName> </configuration> </plugin> </plugins> </build> -</project>
\ No newline at end of file +</project> diff --git a/server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java b/server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java index ece3f384ad2..bbcdaa05d18 100644 --- a/server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java +++ b/server/sonar-search/src/main/java/org/sonar/search/ElasticSearch.java @@ -19,22 +19,14 @@ */ package org.sonar.search; -import org.apache.commons.lang.StringUtils; -import org.elasticsearch.common.logging.ESLoggerFactory; -import org.elasticsearch.common.logging.slf4j.Slf4jESLoggerFactory; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.sonar.process.Props; import org.sonar.search.script.ListUpdate; public class ElasticSearch extends org.sonar.process.Process { - private static final Logger LOGGER = LoggerFactory.getLogger(ElasticSearch.class); - - public static final String ES_DEBUG_PROPERTY = "esDebug"; public static final String ES_PORT_PROPERTY = "esPort"; public static final String ES_CLUSTER_PROPERTY = "esCluster"; @@ -51,25 +43,21 @@ public class ElasticSearch extends org.sonar.process.Process { super(props); - if (StringUtils.isEmpty(props.of(ES_HOME_PROPERTY, null))) { + String home = props.of(ES_HOME_PROPERTY); + if (home == null) { throw new IllegalStateException(MISSING_ES_HOME); } - String home = props.of(ES_HOME_PROPERTY); - - if (StringUtils.isEmpty(props.of(ES_PORT_PROPERTY, null))) { + Integer port = props.intOf(ES_PORT_PROPERTY); + if (port == null) { throw new IllegalStateException(MISSING_ES_PORT); } - Integer port = props.intOf(ES_PORT_PROPERTY); - String clusterName = props.of(ES_CLUSTER_PROPERTY, DEFAULT_CLUSTER_NAME); - ESLoggerFactory.setDefaultFactory(new Slf4jESLoggerFactory()); - ImmutableSettings.Builder esSettings = ImmutableSettings.settingsBuilder() - .put("discovery.zen.ping.multicast.enable", "false") + .put("discovery.zen.ping.multicast.enabled", "false") .put("index.merge.policy.max_merge_at_once", "200") .put("index.merge.policy.segments_per_tier", "200") @@ -86,9 +74,6 @@ public class ElasticSearch extends org.sonar.process.Process { .put("node.name", "sonarqube-" + System.currentTimeMillis()) .put("node.data", true) .put("node.local", false) - -// .put("network.bind_host", "127.0.0.1") - .put("transport.tcp.port", port) .put("path.home", home); @@ -110,13 +95,14 @@ public class ElasticSearch extends org.sonar.process.Process { try { Thread.currentThread().join(); } catch (InterruptedException e) { - LOGGER.warn("ES Process has been interrupted"); + // TODO use java.util.logging + e.printStackTrace(); } } public void onStop() { if (node != null) { - this.node.close(); + node.close(); } } @@ -125,4 +111,4 @@ public class ElasticSearch extends org.sonar.process.Process { ElasticSearch elasticSearch = new ElasticSearch(props); elasticSearch.start(); } -}
\ No newline at end of file +} diff --git a/server/sonar-search/src/main/java/org/sonar/search/package-info.java b/server/sonar-search/src/main/java/org/sonar/search/package-info.java new file mode 100644 index 00000000000..7d4341cf6f2 --- /dev/null +++ b/server/sonar-search/src/main/java/org/sonar/search/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package org.sonar.search; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-search/src/main/java/org/sonar/search/script/ListUpdate.java b/server/sonar-search/src/main/java/org/sonar/search/script/ListUpdate.java index d0acd6b3393..41c4c34f965 100644 --- a/server/sonar-search/src/main/java/org/sonar/search/script/ListUpdate.java +++ b/server/sonar-search/src/main/java/org/sonar/search/script/ListUpdate.java @@ -28,9 +28,6 @@ import org.elasticsearch.script.NativeScriptFactory; import java.util.Collection; import java.util.Map; -/** - * @since 4.4 - */ public class ListUpdate extends AbstractExecutableScript { public static final String NAME = "listUpdate"; diff --git a/server/sonar-search/src/main/java/org/sonar/search/script/package-info.java b/server/sonar-search/src/main/java/org/sonar/search/script/package-info.java new file mode 100644 index 00000000000..86177fd7841 --- /dev/null +++ b/server/sonar-search/src/main/java/org/sonar/search/script/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package org.sonar.search.script; + +import javax.annotation.ParametersAreNonnullByDefault; |