no IOException in Admin client API

This commit is contained in:
Jörg Prante 2021-04-21 17:18:33 +02:00
parent ef880900f8
commit 2749fe2611
3 changed files with 7 additions and 12 deletions

View file

@ -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<String, ?> getMapping(IndexDefinition indexDefinition) throws IOException;
Map<String, ?> 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);
}

View file

@ -117,7 +117,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 null;
}
@ -415,16 +415,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

View file

@ -1,6 +1,6 @@
group = org.xbib
name = elx
version = 2.2.1.42
version = 2.2.1.43
gradle.wrapper.version = 6.6.1
xbib-metrics.version = 2.1.0