Skip to content

Commit

Permalink
use CatchFuntion.
Browse files Browse the repository at this point in the history
  • Loading branch information
hfutatzhanghb committed Oct 11, 2024
1 parent 915f8d3 commit 49d7587
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import org.apache.hadoop.hdfs.protocolPB.AsyncRpcProtocolPBUtil;
import org.apache.hadoop.hdfs.server.federation.router.async.ApplyFunction;
import org.apache.hadoop.hdfs.server.federation.router.async.AsyncCatchFunction;
import org.apache.hadoop.hdfs.server.federation.router.async.CatchFunction;
import org.apache.hadoop.thirdparty.com.google.common.cache.CacheBuilder;
import org.apache.hadoop.thirdparty.com.google.common.cache.CacheLoader;
import org.apache.hadoop.thirdparty.com.google.common.cache.LoadingCache;
Expand Down Expand Up @@ -832,7 +833,7 @@ <T> T invokeAtAvailableNsAsync(RemoteMethod method, Class<T> clazz)
throw ioe;
}
nss.removeIf(n -> n.getNameserviceId().equals(nsId));
invokeOnNs(method, clazz, io, nss);
invokeOnNsAsync(method, clazz, io, nss);
}, IOException.class);
} else {
// If not have default NS.
Expand Down Expand Up @@ -907,13 +908,14 @@ <T> T invokeOnNsAsync(RemoteMethod method, Class<T> clazz, IOException ioe,
});
});

asyncCatch((AsyncCatchFunction<T, IOException>)(ret, ex) -> {
asyncCatch((CatchFunction<T, IOException>)(ret, ex) -> {
LOG.debug("Failed to invoke {} on namespace {}", method, nsId, ex);
// Ignore the exception and try on other namespace, if the tried
// namespace is unavailable, else throw the received exception.
if (!clientProto.isUnavailableSubclusterException(ex)) {
throw ex;
}
return null;
}, IOException.class);
});

Expand Down

0 comments on commit 49d7587

Please sign in to comment.