(final Object resp)
| 864 | private void addMultiActionCallbacks(final MultiAction request) { |
| 865 | final class MultiActionCallback implements Callback<Object, Object> { |
| 866 | public Object call(final Object resp) { |
| 867 | if (!(resp instanceof MultiAction.Response)) { |
| 868 | if (resp instanceof BatchableRpc) { // Single-RPC multi-action? |
| 869 | return null; // Yes, nothing to do. See multiActionToSingleAction. |
| 870 | } else if (resp instanceof Exception) { |
| 871 | return handleException((Exception) resp); |
| 872 | } |
| 873 | throw new InvalidResponseException(MultiAction.Response.class, resp); |
| 874 | } |
| 875 | final MultiAction.Response response = (MultiAction.Response) resp; |
| 876 | final ArrayList<BatchableRpc> batch = request.batch(); |
| 877 | final int n = batch.size(); |
| 878 | for (int i = 0; i < n; i++) { |
| 879 | final BatchableRpc rpc = batch.get(i); |
| 880 | final Object r = response.result(i); |
| 881 | if (r instanceof RecoverableException) { |
| 882 | if (r instanceof NotServingRegionException) { |
| 883 | // We need to do NSRE handling here too, as the response might |
| 884 | // have come back successful, but only some parts of the batch |
| 885 | // could have encountered an NSRE. |
| 886 | hbase_client.handleNSRE(rpc, rpc.getRegion().name(), |
| 887 | (NotServingRegionException) r); |
| 888 | } else { |
| 889 | retryEdit(rpc, (RecoverableException) r); |
| 890 | } |
| 891 | } else { |
| 892 | rpc.callback(r); |
| 893 | } |
| 894 | } |
| 895 | // We're successful. If there was a problem, the exception was |
| 896 | // delivered to the specific RPCs that failed, and they will be |
| 897 | // responsible for retrying. |
| 898 | return null; |
| 899 | } |
| 900 | |
| 901 | private Object handleException(final Exception e) { |
| 902 | if (!(e instanceof RecoverableException)) { |
nothing calls this directly
no test coverage detected