连接超时未按预期工作

时间:2016-05-21 17:04:39

标签: java asynchttpclient

我正在尝试连接到远程服务器并将连接超时设置为120秒。有时它连接,有时甚至在尝试2分钟之前就会抛出连接超时。

setConnectTimeout(120000);
setReadTimeout(120000);

我正在使用AsyncHttpClientConfig来设置这些属性。

以下是错误:

  

java.util.concurrent.ExecutionException:java.net.ConnectException:   连接超时:at   com.ning.http.client.providers.netty.future.NettyResponseFuture.abort(NettyResponseFuture.java:231)     在   com.ning.http.client.providers.netty.request.NettyConnectListener.onFutureFailure(NettyConnectListener.java:137)     在   com.ning.http.client.providers.netty.request.NettyConnectListener.operationComplete(NettyConnectListener.java:145)     在   org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:409)     在   org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:400)     在   org.jboss.netty.channel.DefaultChannelFuture.setFailure(DefaultChannelFuture.java:362)     在   org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:142)     在   org.jboss.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:83)     在   org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)     在   org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)     在   org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)     在   org.jboss.netty.util.internal.DeadLockProofWorker $ 1.run(DeadLockProofWorker.java:42)     在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617)     在java.lang.Thread.run(Thread.java:745)引起:   java.net.ConnectException:连接超时:at   com.ning.http.client.providers.netty.request.NettyConnectListener.onFutureFailure(NettyConnectListener.java:133)     ... 13更多引起:   org.jboss.netty.channel.ConnectTimeoutException:连接超时:       在   org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:139)     ......还有8个

0 个答案:

没有答案