remove TimeoutException from transport future signature

This commit is contained in:
kimchy 2010-04-26 00:33:33 +03:00
parent ce3eef6a15
commit 3039e5b0c6
3 changed files with 7 additions and 6 deletions

View File

@ -35,7 +35,6 @@ import org.elasticsearch.util.settings.Settings;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/** /**
* @author kimchy (shay.banon) * @author kimchy (shay.banon)
@ -70,7 +69,7 @@ public class MembershipAction extends AbstractComponent {
transportService.sendRequest(node, LeaveRequestRequestHandler.ACTION, new LeaveRequest(masterNode), VoidTransportResponseHandler.INSTANCE_NOSPAWN); transportService.sendRequest(node, LeaveRequestRequestHandler.ACTION, new LeaveRequest(masterNode), VoidTransportResponseHandler.INSTANCE_NOSPAWN);
} }
public void sendLeaveRequestBlocking(DiscoveryNode masterNode, DiscoveryNode node, TimeValue timeout) throws ElasticSearchException, TimeoutException { public void sendLeaveRequestBlocking(DiscoveryNode masterNode, DiscoveryNode node, TimeValue timeout) throws ElasticSearchException {
transportService.submitRequest(masterNode, LeaveRequestRequestHandler.ACTION, new LeaveRequest(node), VoidTransportResponseHandler.INSTANCE_NOSPAWN).txGet(timeout.millis(), TimeUnit.MILLISECONDS); transportService.submitRequest(masterNode, LeaveRequestRequestHandler.ACTION, new LeaveRequest(node), VoidTransportResponseHandler.INSTANCE_NOSPAWN).txGet(timeout.millis(), TimeUnit.MILLISECONDS);
} }
@ -78,7 +77,7 @@ public class MembershipAction extends AbstractComponent {
transportService.sendRequest(masterNode, JoinRequestRequestHandler.ACTION, new JoinRequest(node), VoidTransportResponseHandler.INSTANCE_NOSPAWN); transportService.sendRequest(masterNode, JoinRequestRequestHandler.ACTION, new JoinRequest(node), VoidTransportResponseHandler.INSTANCE_NOSPAWN);
} }
public void sendJoinRequestBlocking(DiscoveryNode masterNode, DiscoveryNode node, TimeValue timeout) throws ElasticSearchException, TimeoutException { public void sendJoinRequestBlocking(DiscoveryNode masterNode, DiscoveryNode node, TimeValue timeout) throws ElasticSearchException {
transportService.submitRequest(masterNode, JoinRequestRequestHandler.ACTION, new JoinRequest(node), VoidTransportResponseHandler.INSTANCE_NOSPAWN).txGet(timeout.millis(), TimeUnit.MILLISECONDS); transportService.submitRequest(masterNode, JoinRequestRequestHandler.ACTION, new JoinRequest(node), VoidTransportResponseHandler.INSTANCE_NOSPAWN).txGet(timeout.millis(), TimeUnit.MILLISECONDS);
} }

View File

@ -21,6 +21,7 @@ package org.elasticsearch.transport;
import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.ElasticSearchInterruptedException; import org.elasticsearch.ElasticSearchInterruptedException;
import org.elasticsearch.ElasticSearchTimeoutException;
import org.elasticsearch.util.concurrent.AbstractFuture; import org.elasticsearch.util.concurrent.AbstractFuture;
import org.elasticsearch.util.io.stream.Streamable; import org.elasticsearch.util.io.stream.Streamable;
@ -53,9 +54,11 @@ public class PlainTransportFuture<V extends Streamable> extends AbstractFuture<V
} }
} }
@Override public V txGet(long timeout, TimeUnit unit) throws ElasticSearchException, TimeoutException { @Override public V txGet(long timeout, TimeUnit unit) throws ElasticSearchException {
try { try {
return get(timeout, unit); return get(timeout, unit);
} catch (TimeoutException e) {
throw new ElasticSearchTimeoutException(e.getMessage());
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new ElasticSearchInterruptedException(e.getMessage()); throw new ElasticSearchInterruptedException(e.getMessage());
} catch (ExecutionException e) { } catch (ExecutionException e) {

View File

@ -23,7 +23,6 @@ import org.elasticsearch.ElasticSearchException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/** /**
* @author kimchy (Shay Banon) * @author kimchy (Shay Banon)
@ -40,6 +39,6 @@ public interface TransportFuture<V> extends Future<V> {
* Waits if necessary for at most the given time for the computation * Waits if necessary for at most the given time for the computation
* to complete, and then retrieves its result, if available. * to complete, and then retrieves its result, if available.
*/ */
V txGet(long timeout, TimeUnit unit) throws ElasticSearchException, TimeoutException; V txGet(long timeout, TimeUnit unit) throws ElasticSearchException;
} }