| 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; |