get rid of retry timeout exception

This commit is contained in:
javanna 2016-05-04 15:47:38 +02:00 committed by Luca Cavanna
parent 25892351e7
commit 94cf8437d0
4 changed files with 3 additions and 59 deletions

View File

@ -33,9 +33,9 @@ public final class RestClient implements Closeable {
this.transport = new Transport<>(client, connectionPool, maxRetryTimeout);
}
public ElasticsearchResponse performRequest(Verb verb, String endpoint, Map<String, Object> params, HttpEntity entity)
public ElasticsearchResponse performRequest(String method, String endpoint, Map<String, Object> params, HttpEntity entity)
throws IOException {
return transport.performRequest(verb, endpoint, params, entity);
return transport.performRequest(method, endpoint, params, entity);
}
@Override

View File

@ -1,29 +0,0 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.client;
import java.io.IOException;
public class RetryTimeoutException extends IOException {
RetryTimeoutException(String message) {
super(message);
}
}

View File

@ -88,7 +88,7 @@ final class Transport<C extends Connection> implements Closeable {
long timeElapsed = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
long timeout = retryTimeout - timeElapsed;
if (timeout <= 0) {
RetryTimeoutException retryTimeoutException = new RetryTimeoutException(
IOException retryTimeoutException = new IOException(
"request retries exceeded max retry timeout [" + retryTimeout + "]");
retryTimeoutException.addSuppressed(lastSeenException);
throw retryTimeoutException;

View File

@ -1,27 +0,0 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.client;
/**
* Holds the http verbs/methods supported by elasticsearch, which can be used when sending a request
*/
public enum Verb {
DELETE, GET, HEAD, POST, PUT
}