Skip to content

Commit

Permalink
destroy invoker before client
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenlj committed Jul 22, 2021
1 parent b7ddcac commit 7534b83
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,9 @@ public void destroy() {
}
}
}
// put here to reduce the chance of accepting new invocation after client closed.
// close invoker and then client.
super.destroy();

for (String key : new ArrayList<String>(referenceClientMap.keySet())) {
ExchangeClient client = referenceClientMap.remove(key);
Expand Down Expand Up @@ -466,6 +469,5 @@ public void destroy() {
}
}
stubServiceMethodsMap.clear();
super.destroy();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public ResponseFuture request(Object request, int timeout) throws RemotingExcept
private void warning(Object request) {
if (requestWithWarning) {
if (warningcount.get() % 5000 == 0) {
logger.warn(url.getAddress() + " " + url.getServiceKey() + "safe guard client , should not be called ,must have a bug.");
logger.warn(url.getAddress() + " " + url.getServiceKey() + " safeguard client get called after real client closed, recreating connection...");
}
warningcount.incrementAndGet();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ public void startClose() {
private LazyConnectExchangeClient replaceWithLazyClient() {
// this is a defensive operation to avoid client is closed by accident, the initial state of the client is false
URL lazyUrl = url.addParameter(Constants.LAZY_CONNECT_INITIAL_STATE_KEY, Boolean.TRUE)
.addParameter(Constants.SEND_RECONNECT_KEY, Boolean.TRUE.toString());
.addParameter(Constants.SEND_RECONNECT_KEY, Boolean.TRUE.toString())
.addParameter(LazyConnectExchangeClient.REQUEST_WITH_WARNING_KEY, true);


String key = url.getAddress();
// in worst case there's only one ghost connection.
Expand Down

0 comments on commit 7534b83

Please sign in to comment.