Skip to content

Commit

Permalink
fix: netty3 check channel available
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnights committed May 9, 2019
1 parent 8c8562c commit 280be47
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ protected void notify(URL refUrl, NotifyListener listener, List<URL> urls) {
}

// refresh local urls cache
for (String nodeType : nodeTypeUrlsInRs.keySet()) {
curls.put(nodeType, nodeTypeUrlsInRs.get(nodeType));
}
curls.putAll(nodeTypeUrlsInRs);

for (List<URL> us : nodeTypeUrlsInRs.values()) {
listener.notify(getUrl(), us);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ public synchronized void close(int timeout) {
channel.close();
}
} catch (Exception e) {
LoggerUtil
.error("NettyChannel close Error: " + nettyClient.getUrl().getUri() + " local=" + localAddress, e);
LoggerUtil.error("NettyChannel close Error: " + nettyClient.getUrl().getUri() + " local=" + localAddress, e);
}
}

Expand All @@ -202,7 +201,7 @@ public boolean isClosed() {

@Override
public boolean isAvailable() {
return state.isAliveState();
return state.isAliveState() && channel != null && channel.isConnected();
}

@Override
Expand Down

0 comments on commit 280be47

Please # to comment.