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

Method multiActionToSingleAction

src/RegionClient.java:1073–1091  ·  view source on GitHub ↗

Transforms the given single-edit multi-put into a regular single-put. @param multiput The single-edit multi-put to transform.

(final MultiAction batch)

Source from the content-addressed store, hash-verified

1071 * @param multiput The single-edit multi-put to transform.
1072 */
1073 private BatchableRpc multiActionToSingleAction(final MultiAction batch) {
1074 final BatchableRpc rpc = batch.batch().get(0);
1075 addSingleEditCallbacks(rpc);
1076 // Once the single-edit is done, we still need to make sure we're
1077 // going to run the callback chain of the MultiAction.
1078 final class Multi2SingleCB implements Callback<Object, Object> {
1079 public Object call(final Object arg) {
1080 // If there was a problem, let the MultiAction know.
1081 // Otherwise, give the HBaseRpc in argument to the MultiAction
1082 // callback. This is kind of a kludge: the MultiAction callback
1083 // will understand that this means that this single-RPC was already
1084 // successfully executed on its own.
1085 batch.callback(arg instanceof Exception ? arg : rpc);
1086 return arg;
1087 }
1088 }
1089 rpc.getDeferred().addBoth(new Multi2SingleCB());
1090 return rpc;
1091 }
1092
1093 // -------------------------------------- //
1094 // Managing the life-cycle of the channel //

Callers 1

sendRpcMethod · 0.95

Calls 4

batchMethod · 0.80
getMethod · 0.45
getDeferredMethod · 0.45

Tested by

no test coverage detected