HADOOP-12464. Interrupted client may try to fail-over and retry. Contributed by Kihwal Lee.

This commit is contained in:
Kihwal Lee 2015-10-19 10:52:29 -05:00
parent 151eab2a12
commit 6144e0137b
3 changed files with 8 additions and 8 deletions

View File

@ -1365,6 +1365,8 @@ Release 2.7.2 - UNRELEASED
HADOOP-12465. Incorrect javadoc in WritableUtils.java.
(Jagadesh Kiran N via aajisaka)
HADOOP-12464. Interrupted client may try to fail-over and retry (kihwal)
Release 2.7.1 - 2015-07-06
INCOMPATIBLE CHANGES

View File

@ -104,6 +104,10 @@ public Object invoke(Object proxy, Method method, Object[] args)
hasMadeASuccessfulCall = true;
return ret;
} catch (Exception ex) {
if (Thread.currentThread().isInterrupted()) {
// If interrupted, do not retry.
throw ex;
}
boolean isIdempotentOrAtMostOnce = proxyProvider.getInterface()
.getMethod(method.getName(), method.getParameterTypes())
.isAnnotationPresent(Idempotent.class);

View File

@ -1428,20 +1428,14 @@ public Writable call(RPC.RpcKind rpcKind, Writable rpcRequest,
throw new IOException(e);
}
boolean interrupted = false;
synchronized (call) {
while (!call.done) {
try {
call.wait(); // wait for the result
} catch (InterruptedException ie) {
// save the fact that we were interrupted
interrupted = true;
}
}
if (interrupted) {
// set the interrupt flag now that we are done waiting
Thread.currentThread().interrupt();
throw new InterruptedIOException("Call interrupted");
}
}
if (call.error != null) {