|
@@ -165,6 +165,8 @@ public class RouterRpcClient {
|
|
* @param router A router using this RPC client.
|
|
* @param router A router using this RPC client.
|
|
* @param resolver A NN resolver to determine the currently active NN in HA.
|
|
* @param resolver A NN resolver to determine the currently active NN in HA.
|
|
* @param monitor Optional performance monitor.
|
|
* @param monitor Optional performance monitor.
|
|
|
|
+ * @param routerStateIdContext the router state context object to hold the state ids for all
|
|
|
|
+ * namespaces.
|
|
*/
|
|
*/
|
|
public RouterRpcClient(Configuration conf, Router router,
|
|
public RouterRpcClient(Configuration conf, Router router,
|
|
ActiveNamenodeResolver resolver, RouterRpcMonitor monitor,
|
|
ActiveNamenodeResolver resolver, RouterRpcMonitor monitor,
|
|
@@ -484,7 +486,7 @@ public class RouterRpcClient {
|
|
* Invokes a method against the ClientProtocol proxy server. If a standby
|
|
* Invokes a method against the ClientProtocol proxy server. If a standby
|
|
* exception is generated by the call to the client, retries using the
|
|
* exception is generated by the call to the client, retries using the
|
|
* alternate server.
|
|
* alternate server.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|
|
@@ -492,6 +494,7 @@ public class RouterRpcClient {
|
|
* @param namenodes A prioritized list of namenodes within the same
|
|
* @param namenodes A prioritized list of namenodes within the same
|
|
* nameservice.
|
|
* nameservice.
|
|
* @param useObserver Whether to use observer namenodes.
|
|
* @param useObserver Whether to use observer namenodes.
|
|
|
|
+ * @param protocol the protocol of the connection.
|
|
* @param method Remote ClientProtocol method to invoke.
|
|
* @param method Remote ClientProtocol method to invoke.
|
|
* @param params Variable list of parameters matching the method.
|
|
* @param params Variable list of parameters matching the method.
|
|
* @return The result of invoking the method.
|
|
* @return The result of invoking the method.
|
|
@@ -690,7 +693,7 @@ public class RouterRpcClient {
|
|
/**
|
|
/**
|
|
* Invokes a method on the designated object. Catches exceptions specific to
|
|
* Invokes a method on the designated object. Catches exceptions specific to
|
|
* the invocation.
|
|
* the invocation.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|
|
@@ -700,7 +703,7 @@ public class RouterRpcClient {
|
|
* @param obj Target object for the method
|
|
* @param obj Target object for the method
|
|
* @param params Variable parameters
|
|
* @param params Variable parameters
|
|
* @return Response from the remote server
|
|
* @return Response from the remote server
|
|
- * @throws IOException
|
|
|
|
|
|
+ * @throws IOException If error occurs.
|
|
*/
|
|
*/
|
|
private Object invoke(String nsId, int retryCount, final Method method,
|
|
private Object invoke(String nsId, int retryCount, final Method method,
|
|
final Object obj, final Object... params) throws IOException {
|
|
final Object obj, final Object... params) throws IOException {
|
|
@@ -764,9 +767,10 @@ public class RouterRpcClient {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Check if the cluster of given nameservice id is available.
|
|
* Check if the cluster of given nameservice id is available.
|
|
|
|
+ *
|
|
* @param nsId nameservice ID.
|
|
* @param nsId nameservice ID.
|
|
- * @return
|
|
|
|
- * @throws IOException
|
|
|
|
|
|
+ * @return true if the cluster with given nameservice id is available.
|
|
|
|
+ * @throws IOException if error occurs.
|
|
*/
|
|
*/
|
|
private boolean isClusterUnAvailable(String nsId) throws IOException {
|
|
private boolean isClusterUnAvailable(String nsId) throws IOException {
|
|
List<? extends FederationNamenodeContext> nnState = this.namenodeResolver
|
|
List<? extends FederationNamenodeContext> nnState = this.namenodeResolver
|
|
@@ -871,14 +875,15 @@ public class RouterRpcClient {
|
|
/**
|
|
/**
|
|
* Invokes a ClientProtocol method. Determines the target nameservice via a
|
|
* Invokes a ClientProtocol method. Determines the target nameservice via a
|
|
* provided block.
|
|
* provided block.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|
|
* @param block Block used to determine appropriate nameservice.
|
|
* @param block Block used to determine appropriate nameservice.
|
|
* @param method The remote method and parameters to invoke.
|
|
* @param method The remote method and parameters to invoke.
|
|
* @param locations The remote locations will be used.
|
|
* @param locations The remote locations will be used.
|
|
- * @param clazz – Class for the return type.
|
|
|
|
|
|
+ * @param clazz Class for the return type.
|
|
|
|
+ * @param <T> The type of the remote method return.
|
|
* @return The result of invoking the method.
|
|
* @return The result of invoking the method.
|
|
* @throws IOException If the invoke generated an error.
|
|
* @throws IOException If the invoke generated an error.
|
|
*/
|
|
*/
|
|
@@ -891,7 +896,7 @@ public class RouterRpcClient {
|
|
/**
|
|
/**
|
|
* Invokes a ClientProtocol method. Determines the target nameservice using
|
|
* Invokes a ClientProtocol method. Determines the target nameservice using
|
|
* the block pool id.
|
|
* the block pool id.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|
|
@@ -908,7 +913,7 @@ public class RouterRpcClient {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Invokes a ClientProtocol method against the specified namespace.
|
|
* Invokes a ClientProtocol method against the specified namespace.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|
|
@@ -937,7 +942,7 @@ public class RouterRpcClient {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Invokes a remote method against the specified namespace.
|
|
* Invokes a remote method against the specified namespace.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|
|
@@ -957,7 +962,7 @@ public class RouterRpcClient {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Invokes a remote method against the specified extendedBlock.
|
|
* Invokes a remote method against the specified extendedBlock.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|
|
@@ -978,12 +983,14 @@ public class RouterRpcClient {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Invokes a single proxy call for a single location.
|
|
* Invokes a single proxy call for a single location.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|
|
* @param location RemoteLocation to invoke.
|
|
* @param location RemoteLocation to invoke.
|
|
* @param remoteMethod The remote method and parameters to invoke.
|
|
* @param remoteMethod The remote method and parameters to invoke.
|
|
|
|
+ * @param clazz Class for the return type.
|
|
|
|
+ * @param <T> The type of the remote method return.
|
|
* @return The result of invoking the method if successful.
|
|
* @return The result of invoking the method if successful.
|
|
* @throws IOException If the invoke generated an error.
|
|
* @throws IOException If the invoke generated an error.
|
|
*/
|
|
*/
|
|
@@ -1001,10 +1008,11 @@ public class RouterRpcClient {
|
|
*
|
|
*
|
|
* @param locations List of locations/nameservices to call concurrently.
|
|
* @param locations List of locations/nameservices to call concurrently.
|
|
* @param remoteMethod The remote method and parameters to invoke.
|
|
* @param remoteMethod The remote method and parameters to invoke.
|
|
|
|
+ * @param <T> The type of the remote method return.
|
|
* @return The result of the first successful call, or if no calls are
|
|
* @return The result of the first successful call, or if no calls are
|
|
- * successful, the result of the last RPC call executed.
|
|
|
|
|
|
+ * successful, the result of the last RPC call executed.
|
|
* @throws IOException if the success condition is not met and one of the RPC
|
|
* @throws IOException if the success condition is not met and one of the RPC
|
|
- * calls generated a remote exception.
|
|
|
|
|
|
+ * calls generated a remote exception.
|
|
*/
|
|
*/
|
|
public <T> T invokeSequential(
|
|
public <T> T invokeSequential(
|
|
final List<? extends RemoteLocationContext> locations,
|
|
final List<? extends RemoteLocationContext> locations,
|
|
@@ -1270,7 +1278,7 @@ public class RouterRpcClient {
|
|
/**
|
|
/**
|
|
* Invoke multiple concurrent proxy calls to different clients. Returns an
|
|
* Invoke multiple concurrent proxy calls to different clients. Returns an
|
|
* array of results.
|
|
* array of results.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|
|
@@ -1289,14 +1297,15 @@ public class RouterRpcClient {
|
|
/**
|
|
/**
|
|
* Invoke multiple concurrent proxy calls to different clients. Returns an
|
|
* Invoke multiple concurrent proxy calls to different clients. Returns an
|
|
* array of results.
|
|
* array of results.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|
|
- * @param <T> The type of the remote location.
|
|
|
|
- * @param <R> The type of the remote method return.
|
|
|
|
* @param locations List of remote locations to call concurrently.
|
|
* @param locations List of remote locations to call concurrently.
|
|
* @param method The remote method and parameters to invoke.
|
|
* @param method The remote method and parameters to invoke.
|
|
|
|
+ * @param clazz Type of the remote return type.
|
|
|
|
+ * @param <T> The type of the remote location.
|
|
|
|
+ * @param <R> The type of the remote method return.
|
|
* @return Result of invoking the method per subcluster: nsId to result.
|
|
* @return Result of invoking the method per subcluster: nsId to result.
|
|
* @throws IOException If all the calls throw an exception.
|
|
* @throws IOException If all the calls throw an exception.
|
|
*/
|
|
*/
|
|
@@ -1309,7 +1318,7 @@ public class RouterRpcClient {
|
|
/**
|
|
/**
|
|
* Invoke multiple concurrent proxy calls to different clients. Returns an
|
|
* Invoke multiple concurrent proxy calls to different clients. Returns an
|
|
* array of results.
|
|
* array of results.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|
|
@@ -1332,7 +1341,7 @@ public class RouterRpcClient {
|
|
/**
|
|
/**
|
|
* Invokes multiple concurrent proxy calls to different clients. Returns an
|
|
* Invokes multiple concurrent proxy calls to different clients. Returns an
|
|
* array of results.
|
|
* array of results.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|
|
@@ -1360,7 +1369,7 @@ public class RouterRpcClient {
|
|
/**
|
|
/**
|
|
* Invokes multiple concurrent proxy calls to different clients. Returns an
|
|
* Invokes multiple concurrent proxy calls to different clients. Returns an
|
|
* array of results.
|
|
* array of results.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|
|
@@ -1422,7 +1431,7 @@ public class RouterRpcClient {
|
|
/**
|
|
/**
|
|
* Invokes multiple concurrent proxy calls to different clients. Returns an
|
|
* Invokes multiple concurrent proxy calls to different clients. Returns an
|
|
* array of results.
|
|
* array of results.
|
|
- *
|
|
|
|
|
|
+ * <p>
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* Re-throws exceptions generated by the remote RPC call as either
|
|
* RemoteException or IOException.
|
|
* RemoteException or IOException.
|
|
*
|
|
*
|