HDFS-14937. [SBN read] ObserverReadProxyProvider should throw InterruptException. Contributed by xuzq.

This commit is contained in:
Ayush Saxena 2019-12-29 13:07:22 +05:30
parent ee51eadda0
commit 62423910a4
1 changed files with 8 additions and 0 deletions

View File

@ -19,6 +19,7 @@ package org.apache.hadoop.hdfs.server.namenode.ha;
import java.io.Closeable;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
@ -412,6 +413,13 @@ public class ObserverReadProxyProvider<T>
throw ite.getCause();
}
Exception e = (Exception) ite.getCause();
if (e instanceof InterruptedIOException ||
e instanceof InterruptedException) {
// If interrupted, do not retry.
LOG.warn("Invocation returned interrupted exception on [{}];",
current.proxyInfo, e);
throw e;
}
if (e instanceof RemoteException) {
RemoteException re = (RemoteException) e;
Exception unwrapped = re.unwrapRemoteException(