Skip to content

Commit

Permalink
AsyncTableImpl should call coprocessor callbacks in a defined order
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesconnell committed Aug 20, 2024
1 parent 41dd87c commit 02b99bc
Showing 1 changed file with 2 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,32 +296,9 @@ public <S, R> CompletableFuture<R> coprocessorService(Function<RpcChannel, S> st
public <S, R> CoprocessorServiceBuilder<S, R> coprocessorService(
Function<RpcChannel, S> stubMaker, ServiceCaller<S, R> callable,
CoprocessorCallback<R> callback) {
final Context context = Context.current();
CoprocessorCallback<R> wrappedCallback = new CoprocessorCallback<R>() {

@Override
public void onRegionComplete(RegionInfo region, R resp) {
pool.execute(context.wrap(() -> callback.onRegionComplete(region, resp)));
}

@Override
public void onRegionError(RegionInfo region, Throwable error) {
pool.execute(context.wrap(() -> callback.onRegionError(region, error)));
}

@Override
public void onComplete() {
pool.execute(context.wrap(callback::onComplete));
}

@Override
public void onError(Throwable error) {
pool.execute(context.wrap(() -> callback.onError(error)));
}
};
CoprocessorServiceBuilder<S, R> builder =
rawTable.coprocessorService(stubMaker, callable, wrappedCallback);
return new CoprocessorServiceBuilder<S, R>() {
rawTable.coprocessorService(stubMaker, callable, callback);
return new CoprocessorServiceBuilder<>() {

@Override
public CoprocessorServiceBuilder<S, R> fromRow(byte[] startKey, boolean inclusive) {
Expand Down

0 comments on commit 02b99bc

Please sign in to comment.