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

(cherry picked from commit 6144e0137b)

Conflicts:
	hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java
This commit is contained in:
Kihwal Lee 2015-10-19 11:00:48 -05:00
parent 08c02199ff
commit 3f3829e3a8
3 changed files with 8 additions and 8 deletions

View File

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

View File

@ -103,6 +103,10 @@ public class RetryInvocationHandler<T> implements RpcInvocationHandler {
hasMadeASuccessfulCall = true; hasMadeASuccessfulCall = true;
return ret; return ret;
} catch (Exception e) { } catch (Exception e) {
if (Thread.currentThread().isInterrupted()) {
// If interrupted, do not retry.
throw e;
}
boolean isIdempotentOrAtMostOnce = proxyProvider.getInterface() boolean isIdempotentOrAtMostOnce = proxyProvider.getInterface()
.getMethod(method.getName(), method.getParameterTypes()) .getMethod(method.getName(), method.getParameterTypes())
.isAnnotationPresent(Idempotent.class); .isAnnotationPresent(Idempotent.class);

View File

@ -1460,20 +1460,14 @@ public class Client {
throw new IOException(e); throw new IOException(e);
} }
boolean interrupted = false;
synchronized (call) { synchronized (call) {
while (!call.done) { while (!call.done) {
try { try {
call.wait(); // wait for the result call.wait(); // wait for the result
} catch (InterruptedException ie) { } 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(); Thread.currentThread().interrupt();
throw new InterruptedIOException("Call interrupted");
}
} }
if (call.error != null) { if (call.error != null) {