Skip to content

Commit

Permalink
RpcClientProxy's lastUsedNanos is modified with volatile to avoid inc…
Browse files Browse the repository at this point in the history
…onsistent visibility among multiple threads (#78)
  • Loading branch information
eric-zc1 authored Jan 15, 2025
1 parent d5ad43f commit e7eccb0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static void scanUnusedClient() {
} finally {
logger.warn("RpcClient in clusterName={}, naming={}, remove rpc client{}, due to unused time > {} ms",
bConfig.getName(), bConfig.getNamingOptions().getServiceNaming(),
e.getProtocolConfig().toSimpleString(), e.getProtocolConfig().getIdleTimeout());
e.getProtocolConfig().toSimpleString(), bConfig.getIdleTimeout());
}
}));
}
Expand Down Expand Up @@ -252,7 +252,7 @@ private static class RpcClientProxy implements RpcClient {

private RpcClient delegate;

private long lastUsedNanos = System.nanoTime();
private volatile long lastUsedNanos = System.nanoTime();

RpcClientProxy(RpcClient delegate) {
this.delegate = delegate;
Expand Down

0 comments on commit e7eccb0

Please sign in to comment.