提交 7f035049 编写于 作者: C chao.liuc

合并2.0.12 修改 bugid:193 客户端重连日志出现连接断开一定会出现error日志

git-svn-id: http://code.alibabatech.com/svn/dubbo/trunk@863 1a56cb94-b969-4eaa-88fa-be21384802f2
上级 3b4724a9
......@@ -76,7 +76,7 @@ public abstract class AbstractClient extends AbstractEndpoint implements Client
//the last successed connected time
private long lastConnectedTime = System.currentTimeMillis();
private final int shutdown_timeout ;
private final long shutdown_timeout ;
public AbstractClient(URL url, ChannelHandler handler) throws RemotingException {
......@@ -137,13 +137,15 @@ public abstract class AbstractClient extends AbstractEndpoint implements Client
int reconnect = getReconnectParam(getUrl());
if(reconnect > 0 && reconnectExecutorFuture == null){
Runnable connectStatusCheckCommand = new Runnable() {
String errorMsg = "client reconnect to "+getUrl().getAddress()+" find error . url: "+ getUrl();
public void run() {
try {
if (! isConnected()) {
connect();
} else {
lastConnectedTime = System.currentTimeMillis();
}
} catch (Throwable t) {
String errorMsg = "client reconnect to "+getUrl().getAddress()+" find error . url: "+ getUrl();
int count = reconnect_count.incrementAndGet();
// wait registry sync provider list
if (System.currentTimeMillis() - lastConnectedTime > shutdown_timeout){
......@@ -280,7 +282,6 @@ public abstract class AbstractClient extends AbstractEndpoint implements Client
+ NetUtils.getLocalHost() + " using dubbo version " + Version.getVersion()
+ ", cause: Connect wait timeout: " + getTimeout() + "ms.");
}
lastConnectedTime = System.currentTimeMillis();
reconnect_count.set(0);
reconnect_error_log_flag.set(false);
} catch (RemotingException e) {
......@@ -289,7 +290,7 @@ public abstract class AbstractClient extends AbstractEndpoint implements Client
throw new RemotingException(this, "Failed connect to server " + getRemoteAddress() + " from " + getClass().getSimpleName() + " "
+ NetUtils.getLocalHost() + " using dubbo version " + Version.getVersion()
+ ", cause: " + e.getMessage(), e);
} finally {
} finally {
connectLock.unlock();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册