Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
foreverneverer committed Sep 2, 2020
1 parent 181ed6f commit d8f1daa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public void onRpcReply(ClientRequestRound round, long cachedConfigVersion, Strin
}

client_operator operator = round.getOperator();
interceptorManger.interceptAfter(round, operator.rpc_error.errno, this);
interceptorManger.after(round, operator.rpc_error.errno, this);
boolean needQueryMeta = false;
switch (operator.rpc_error.errno) {
case ERR_OK:
Expand Down Expand Up @@ -363,7 +363,7 @@ void call(final ClientRequestRound round) {
tableConfig.replicas.get(round.getOperator().get_gpid().get_pidx());

if (handle.primarySession != null) {
interceptorManger.interceptBefore(round, this);
interceptorManger.before(round, this);
// send request to primary
handle.primarySession.asyncSend(
round.getOperator(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public BackupRequestInterceptor(boolean isOpen) {
}

@Override
public void interceptBefore(ClientRequestRound clientRequestRound, TableHandler tableHandler) {
public void before(ClientRequestRound clientRequestRound, TableHandler tableHandler) {
backupCall(clientRequestRound, tableHandler);
}

@Override
public void interceptAfter(
public void after(
ClientRequestRound clientRequestRound, error_types errno, TableHandler tableHandler) {
// cancel the backup request task
ScheduledFuture<?> backupRequestTask = clientRequestRound.backupRequestTask();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ public InterceptorManger(TableOptions options) {
register(new BackupRequestInterceptor(options.enableBackupRequest()));
}

public InterceptorManger register(TableInterceptor interceptor) {
private InterceptorManger register(TableInterceptor interceptor) {
interceptors.add(interceptor);
return this;
}

public void interceptBefore(ClientRequestRound clientRequestRound, TableHandler tableHandler) {
public void before(ClientRequestRound clientRequestRound, TableHandler tableHandler) {
for (TableInterceptor interceptor : interceptors) {
interceptor.interceptBefore(clientRequestRound, tableHandler);
interceptor.before(clientRequestRound, tableHandler);
}
}

public void interceptAfter(
public void after(
ClientRequestRound clientRequestRound, error_types errno, TableHandler tableHandler) {
for (TableInterceptor interceptor : interceptors) {
interceptor.interceptAfter(clientRequestRound, errno, tableHandler);
interceptor.after(clientRequestRound, errno, tableHandler);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

public interface TableInterceptor {
// The behavior before sending the RPC to a table.
void interceptBefore(ClientRequestRound clientRequestRound, TableHandler tableHandler);
void before(ClientRequestRound clientRequestRound, TableHandler tableHandler);
// The behavior after getting reply or failure of the RPC.
void interceptAfter(
ClientRequestRound clientRequestRound, error_types errno, TableHandler tableHandler);
void after(ClientRequestRound clientRequestRound, error_types errno, TableHandler tableHandler);
}

0 comments on commit d8f1daa

Please sign in to comment.