]> source.dussan.org Git - sonarqube.git/commitdiff
Remove unused fields in SearchClient
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 28 Aug 2014 21:21:51 +0000 (23:21 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 28 Aug 2014 21:21:51 +0000 (23:21 +0200)
server/sonar-server/src/main/java/org/sonar/server/search/SearchClient.java

index eef7012c67f9ab68e08439e9bef95d5243b96ab0..29b2fc86f298aa4e52a03b08f6cd2c902df9de49 100644 (file)
 
 package org.sonar.server.search;
 
-import com.google.common.annotations.VisibleForTesting;
 import org.apache.commons.lang.StringUtils;
 import org.elasticsearch.action.ActionRequestBuilder;
 import org.elasticsearch.action.ActionResponse;
 import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
-import org.elasticsearch.action.admin.cluster.stats.ClusterStatsNodes;
 import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse;
 import org.elasticsearch.client.transport.TransportClient;
 import org.elasticsearch.common.logging.ESLoggerFactory;
@@ -48,30 +46,17 @@ public class SearchClient extends TransportClient {
 
   private static final Logger LOGGER = LoggerFactory.getLogger(SearchClient.class);
 
-  private static final String DEFAULT_HEALTH_TIMEOUT = "30s";
-
-  private final Settings settings;
-  private final String healthTimeout;
-
-  protected final Profiling profiling;
+  private final Profiling profiling;
 
   public SearchClient(Settings settings) {
-    this(settings, DEFAULT_HEALTH_TIMEOUT);
-  }
-
-  @VisibleForTesting
-  SearchClient(Settings settings, String healthTimeout) {
     super(ImmutableSettings.settingsBuilder()
-        .put("network.bind_host", "localhost")
-        .put("node.rack_id", StringUtils.defaultIfEmpty(settings.getString(IndexProperties.NODE_NAME), "unknown"))
-        .put("cluster.name", StringUtils.defaultIfBlank(settings.getString(IndexProperties.CLUSTER_NAME), "sonarqube"))
-        .build()
-    );
+      .put("network.bind_host", "localhost")
+      .put("node.rack_id", StringUtils.defaultIfEmpty(settings.getString(IndexProperties.NODE_NAME), "unknown"))
+      .put("cluster.name", StringUtils.defaultIfBlank(settings.getString(IndexProperties.CLUSTER_NAME), "sonarqube"))
+      .build());
     initLogging();
     this.addTransportAddress(new InetSocketTransportAddress("localhost",
       settings.getInt(IndexProperties.NODE_PORT)));
-    this.settings = settings;
-    this.healthTimeout = healthTimeout;
     this.profiling = new Profiling(settings);
   }
 
@@ -124,7 +109,7 @@ public class SearchClient extends TransportClient {
       }
       return response;
     } catch (Exception e) {
-      LOGGER.error("could not execute request: "   + response);
+      LOGGER.error("could not execute request: " + response);
       throw new IllegalStateException("ES error: ", e);
 
     }