From 7e661271c1af0dd0f8e2e4a81d01840c41531aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Prante?= Date: Wed, 21 Apr 2021 17:20:57 +0200 Subject: [PATCH] no IOException in Admin API --- elx-api/src/main/java/org/xbib/elx/api/AdminClient.java | 9 +++------ .../java/org/xbib/elx/common/AbstractAdminClient.java | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/elx-api/src/main/java/org/xbib/elx/api/AdminClient.java b/elx-api/src/main/java/org/xbib/elx/api/AdminClient.java index 0c5e71a..0e6dbe5 100644 --- a/elx-api/src/main/java/org/xbib/elx/api/AdminClient.java +++ b/elx-api/src/main/java/org/xbib/elx/api/AdminClient.java @@ -1,6 +1,5 @@ package org.xbib.elx.api; -import java.io.IOException; import java.util.List; import java.util.Map; @@ -9,7 +8,7 @@ import java.util.Map; */ public interface AdminClient extends BasicClient { - Map getMapping(IndexDefinition indexDefinition) throws IOException; + Map getMapping(IndexDefinition indexDefinition); void checkMapping(IndexDefinition indexDefinition); @@ -25,9 +24,8 @@ public interface AdminClient extends BasicClient { * @param indexDefinition the index definition * @param level the replica level * @return this - * @throws IOException if replica setting could not be updated */ - AdminClient updateReplicaLevel(IndexDefinition indexDefinition, int level) throws IOException; + AdminClient updateReplicaLevel(IndexDefinition indexDefinition, int level); /** * Get replica level. @@ -92,7 +90,6 @@ public interface AdminClient extends BasicClient { * @param indexDefinition the index definition * @param timestampfieldname the timestamp field name * @return millis UTC millis of the most recent document - * @throws IOException if most rcent document can not be found */ - Long mostRecentDocument(IndexDefinition indexDefinition, String timestampfieldname) throws IOException; + Long mostRecentDocument(IndexDefinition indexDefinition, String timestampfieldname); } diff --git a/elx-common/src/main/java/org/xbib/elx/common/AbstractAdminClient.java b/elx-common/src/main/java/org/xbib/elx/common/AbstractAdminClient.java index 9e2839b..e05ac5b 100644 --- a/elx-common/src/main/java/org/xbib/elx/common/AbstractAdminClient.java +++ b/elx-common/src/main/java/org/xbib/elx/common/AbstractAdminClient.java @@ -53,7 +53,6 @@ import org.xbib.elx.api.IndexDefinition; import org.xbib.elx.api.IndexPruneResult; import org.xbib.elx.api.IndexShiftResult; -import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -111,7 +110,7 @@ public abstract class AbstractAdminClient extends AbstractBasicClient implements } @Override - public AdminClient updateReplicaLevel(IndexDefinition indexDefinition, int level) throws IOException { + public AdminClient updateReplicaLevel(IndexDefinition indexDefinition, int level) { if (isIndexDefinitionDisabled(indexDefinition)) { return this; } @@ -417,16 +416,14 @@ public abstract class AbstractAdminClient extends AbstractBasicClient implements } @Override - public void updateIndexSetting(String index, String key, Object value, long timeout, TimeUnit timeUnit) throws IOException { - if (index == null) { - throw new IOException("no index name given"); - } + public void updateIndexSetting(String index, String key, Object value, long timeout, TimeUnit timeUnit) { ensureClientIsPresent(); Settings.Builder updateSettingsBuilder = Settings.builder(); updateSettingsBuilder.put(key, value.toString()); UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest(index) .settings(updateSettingsBuilder).timeout(toTimeValue(timeout, timeUnit)); client.execute(UpdateSettingsAction.INSTANCE, updateSettingsRequest).actionGet(); + waitForCluster("GREEN", 300L, TimeUnit.SECONDS); } @Override