MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / call

Method call

src/HBaseClient.java:1337–1378  ·  view source on GitHub ↗
(final Object resp)

Source from the content-addressed store, hash-verified

1335
1336 // TODO - double check individual RPC timer timeouts.
1337 public Object call(final Object resp) {
1338 if (!(resp instanceof MultiAction.Response)) {
1339 if (resp instanceof BatchableRpc) { // Single-RPC multi-action?
1340 return null; // Yes, nothing to do. See multiActionToSingleAction.
1341 } else if (resp instanceof Exception) {
1342 return handleException((Exception) resp);
1343 }
1344 throw new InvalidResponseException(MultiAction.Response.class, resp);
1345 }
1346 final MultiAction.Response response = (MultiAction.Response) resp;
1347 final ArrayList<BatchableRpc> batch = request.batch();
1348 final int n = batch.size();
1349 for (int i = 0; i < n; i++) {
1350 final BatchableRpc rpc = batch.get(i);
1351 final Object r = response.result(i);
1352 if (r instanceof RecoverableException) {
1353 if (r instanceof NotServingRegionException ||
1354 r instanceof RegionMovedException ||
1355 r instanceof RegionServerStoppedException) {
1356 // We need to do NSRE handling here too, as the response might
1357 // have come back successful, but only some parts of the batch
1358 // could have encountered an NSRE.
1359 try {
1360 handleNSRE(rpc, rpc.getRegion().name(),
1361 (NotServingRegionException) r);
1362 } catch (RuntimeException e) {
1363 LOG.error("Unexpected exception processing NSRE for RPC " + rpc, e);
1364 rpc.callback(e);
1365 }
1366 } else {
1367 // TODO - potentially retry?
1368 //retryEdit(rpc, (RecoverableException) r);
1369 }
1370 } else {
1371 rpc.callback(r);
1372 }
1373 }
1374 // We're successful. If there was a problem, the exception was
1375 // delivered to the specific RPCs that failed, and they will be
1376 // responsible for retrying.
1377 return null;
1378 }
1379
1380 private Object handleException(final Exception e) {
1381 if (!(e instanceof RecoverableException)) {

Callers

nothing calls this directly

Calls 9

handleExceptionMethod · 0.95
batchMethod · 0.80
resultMethod · 0.80
handleNSREMethod · 0.80
sizeMethod · 0.45
getMethod · 0.45
nameMethod · 0.45
getRegionMethod · 0.45
callbackMethod · 0.45

Tested by

no test coverage detected