better exception thrown when failing to handle responses
This commit is contained in:
parent
e85c47db74
commit
a10ab7fe08
|
@ -24,7 +24,9 @@ import java.util.Comparator;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kimchy (Shay Banon)
|
* A {@link TreeSet} that is bounded by size.
|
||||||
|
*
|
||||||
|
* @author kimchy (shay.banon)
|
||||||
*/
|
*/
|
||||||
public class BoundedTreeSet<E> extends TreeSet<E> {
|
public class BoundedTreeSet<E> extends TreeSet<E> {
|
||||||
|
|
||||||
|
|
|
@ -20,15 +20,11 @@
|
||||||
package org.elasticsearch.transport;
|
package org.elasticsearch.transport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kimchy (Shay Banon)
|
* @author kimchy (shay.banon)
|
||||||
*/
|
*/
|
||||||
public class ResponseHandlerFailureTransportException extends TransportException {
|
public class ResponseHandlerFailureTransportException extends RemoteTransportException {
|
||||||
|
|
||||||
public ResponseHandlerFailureTransportException(String msg) {
|
public ResponseHandlerFailureTransportException(Throwable cause) {
|
||||||
super(msg);
|
super(cause.getMessage(), cause);
|
||||||
}
|
|
||||||
|
|
||||||
public ResponseHandlerFailureTransportException(String msg, Throwable cause) {
|
|
||||||
super(msg, cause);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.transport;
|
||||||
import org.elasticsearch.ElasticSearchException;
|
import org.elasticsearch.ElasticSearchException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kimchy (Shay Banon)
|
* @author kimchy (shay.banon)
|
||||||
*/
|
*/
|
||||||
public class TransportException extends ElasticSearchException {
|
public class TransportException extends ElasticSearchException {
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,7 @@ public class LocalTransport extends AbstractLifecycleComponent<Transport> implem
|
||||||
try {
|
try {
|
||||||
handler.handleResponse(streamable);
|
handler.handleResponse(streamable);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(handler, new ResponseHandlerFailureTransportException("Failed to handle response", e));
|
handleException(handler, new ResponseHandlerFailureTransportException(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -246,7 +246,7 @@ public class LocalTransport extends AbstractLifecycleComponent<Transport> implem
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
handler.handleResponse(streamable);
|
handler.handleResponse(streamable);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(handler, new ResponseHandlerFailureTransportException("Failed to handle response", e));
|
handleException(handler, new ResponseHandlerFailureTransportException(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class MessageChannelHandler extends SimpleChannelUpstreamHandler {
|
||||||
try {
|
try {
|
||||||
handler.handleResponse(streamable);
|
handler.handleResponse(streamable);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(handler, new ResponseHandlerFailureTransportException("Failed to handle response", e));
|
handleException(handler, new ResponseHandlerFailureTransportException(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -142,7 +142,7 @@ public class MessageChannelHandler extends SimpleChannelUpstreamHandler {
|
||||||
handler.handleResponse(streamable);
|
handler.handleResponse(streamable);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
handleException(handler, new ResponseHandlerFailureTransportException("Failed to handle response", e));
|
handleException(handler, new ResponseHandlerFailureTransportException(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ public class MessageChannelHandler extends SimpleChannelUpstreamHandler {
|
||||||
|
|
||||||
private void handleException(final TransportResponseHandler handler, Throwable error) {
|
private void handleException(final TransportResponseHandler handler, Throwable error) {
|
||||||
if (!(error instanceof RemoteTransportException)) {
|
if (!(error instanceof RemoteTransportException)) {
|
||||||
error = new RemoteTransportException("None remote transport exception", error);
|
error = new RemoteTransportException(error.getMessage(), error);
|
||||||
}
|
}
|
||||||
final RemoteTransportException rtx = (RemoteTransportException) error;
|
final RemoteTransportException rtx = (RemoteTransportException) error;
|
||||||
if (handler.spawn()) {
|
if (handler.spawn()) {
|
||||||
|
|
Loading…
Reference in New Issue