Browse Source

apply review comments

Simon Willnauer 8 years ago
parent
commit
1c5cc58373

+ 1 - 8
core/src/main/java/org/elasticsearch/action/search/RemoteClusterConnection.java

@@ -145,7 +145,7 @@ final class RemoteClusterConnection extends AbstractComponent implements Transpo
     @Override
     public void onNodeDisconnected(DiscoveryNode node) {
         boolean remove = connectedNodes.remove(node);
-        if (remove == true && connectedNodes.size() < maxNumRemoteConnections) {
+        if (remove && connectedNodes.size() < maxNumRemoteConnections) {
             // try to reconnect and fill up the slot of the disconnected node
             connectHandler.forceConnect();
         }
@@ -226,13 +226,6 @@ final class RemoteClusterConnection extends AbstractComponent implements Transpo
         };
     }
 
-    /**
-     * Returns the alias / name of the remote cluster
-     */
-    public String getClusterAlias() {
-        return clusterAlias;
-    }
-
     @Override
     public void close() throws IOException {
         connectHandler.close();

+ 5 - 5
core/src/main/java/org/elasticsearch/action/search/RemoteClusterService.java

@@ -89,10 +89,10 @@ public final class RemoteClusterService extends AbstractComponent implements Clo
     /**
      * The name of a node attribute to select nodes that should be connected to in the remote cluster.
      * For instance a node can be configured with <tt>node.attr.gateway: true</tt> in order to be eligible as a gateway node between
-     * clusters. In that case <tt>search.remote.node_attribute: gateway</tt> can be used to filter out other nodes in the remote cluster.
+     * clusters. In that case <tt>search.remote.node.attr: gateway</tt> can be used to filter out other nodes in the remote cluster.
      * The value of the setting is expected to be a boolean, <tt>true</tt> for nodes that can become gateways, <tt>false</tt> otherwise.
      */
-    public static final Setting<String> REMOTE_NODE_ATTRIBUTE = Setting.simpleString("search.remote.node_attribute",
+    public static final Setting<String> REMOTE_NODE_ATTRIBUTE = Setting.simpleString("search.remote.node.attr",
         Setting.Property.NodeScope);
 
     private static final char REMOTE_CLUSTER_INDEX_SEPARATOR = ':';
@@ -181,7 +181,7 @@ public final class RemoteClusterService extends AbstractComponent implements Clo
      *
      * @return all indices in the requestIndices array that are not remote cluster indices
      */
-    public String[] filterIndices(Map<String, List<String>> perClusterIndices, String[] requestIndices, Predicate<String> indexExists) {
+    String[] filterIndices(Map<String, List<String>> perClusterIndices, String[] requestIndices, Predicate<String> indexExists) {
         List<String> localIndicesList = new ArrayList<>();
         for (String index : requestIndices) {
             int i = index.indexOf(REMOTE_CLUSTER_INDEX_SEPARATOR);
@@ -317,7 +317,7 @@ public final class RemoteClusterService extends AbstractComponent implements Clo
         return connection.getConnection(node);
     }
 
-    public void updateRemoteCluster(String clusterAlias, List<InetSocketAddress> addresses) {
+    void updateRemoteCluster(String clusterAlias, List<InetSocketAddress> addresses) {
         updateRemoteClusters(Collections.singletonMap(clusterAlias, addresses.stream().map(address -> {
                 TransportAddress transportAddress = new TransportAddress(address);
                 return new DiscoveryNode(clusterAlias + "#" + transportAddress.toString(),
@@ -344,7 +344,7 @@ public final class RemoteClusterService extends AbstractComponent implements Clo
         }));
     }
 
-    static InetSocketAddress parseSeedAddress(String remoteHost) {
+    private static InetSocketAddress parseSeedAddress(String remoteHost) {
         int portSeparator = remoteHost.lastIndexOf(':'); // in case we have a IPv6 address ie. [::1]:9300
         if (portSeparator == -1 || portSeparator == remoteHost.length()) {
             throw new IllegalArgumentException("remote hosts need to be configured as [host:port], found [" + remoteHost + "] instead");

+ 1 - 1
core/src/main/java/org/elasticsearch/action/search/TransportSearchAction.java

@@ -159,7 +159,7 @@ public class TransportSearchAction extends HandledTransportAction<SearchRequest,
         // of just for the _search api
         final Index[] indices;
         if (localIndices.length == 0 && remoteShardIterators.size() > 0) {
-            indices = new Index[0]; // don't search on _all if only remote indices were specified
+            indices = Index.EMPTY_ARRAY; // don't search on _all if only remote indices were specified
         } else {
             indices = indexNameExpressionResolver.concreteIndices(clusterState, searchRequest.indicesOptions(),
                 startTimeInMillis, localIndices);

+ 1 - 1
core/src/main/java/org/elasticsearch/transport/TransportActionProxy.java

@@ -100,7 +100,7 @@ public final class TransportActionProxy {
         Supplier<T> supplier;
         DiscoveryNode targetNode;
 
-        ProxyRequest(Supplier<T>  supplier) {
+        ProxyRequest(Supplier<T> supplier) {
             this.supplier = supplier;
         }