android - Single AsyncHttpClient instance ConnectTimeoutException -
i use android-async-http in project, , asynchttpclient static single instance, code follow step:
- httpurlconnection http request;
- in first request success callback, use asynchttpclient request url;
- get connecttimeoutexception follows:
06-28 18:35:36.440 18638-19939/com.zebra.carcloud.example w/system.err: cz.msebera.android.httpclient.conn.connecttimeoutexception: connect daily.yuncar.zebred.com/139.196.2.83:7090 timed out 06-28 18:35:36.441 18638-19939/com.zebra.carcloud.example w/system.err: @ cz.msebera.android.httpclient.conn.scheme.plainsocketfactory.connectsocket(plainsocketfactory.java:119) 06-28 18:35:36.441 18638-19939/com.zebra.carcloud.example w/system.err: @ cz.msebera.android.httpclient.conn.scheme.plainsocketfactory.connectsocket(plainsocketfactory.java:157) 06-28 18:35:36.441 18638-19939/com.zebra.carcloud.example w/system.err: @ cz.msebera.android.httpclient.conn.scheme.schemesocketfactoryadaptor.connectsocket(schemesocketfactoryadaptor.java:65) 06-28 18:35:36.441 18638-19939/com.zebra.carcloud.example w/system.err: @ cz.msebera.android.httpclient.impl.conn.defaultclientconnectionoperator.openconnection(defaultclientconnectionoperator.java:177) 06-28 18:35:36.441 18638-19939/com.zebra.carcloud.example w/system.err: @ cz.msebera.android.httpclient.impl.conn.abstractpoolentry.open(abstractpoolentry.java:145) 06-28 18:35:36.442 18638-19939/com.zebra.carcloud.example w/system.err: @ cz.msebera.android.httpclient.impl.conn.abstractpooledconnadapter.open(abstractpooledconnadapter.java:131) 06-28 18:35:36.442 18638-19939/com.zebra.carcloud.example w/system.err: @ cz.msebera.android.httpclient.impl.client.defaultrequestdirector.tryconnect(defaultrequestdirector.java:611) 06-28 18:35:36.442 18638-19939/com.zebra.carcloud.example w/system.err: @ cz.msebera.android.httpclient.impl.client.defaultrequestdirector.execute(defaultrequestdirector.java:446) 06-28 18:35:36.442 18638-19939/com.zebra.carcloud.example w/system.err: @ cz.msebera.android.httpclient.impl.client.abstracthttpclient.doexecute(abstracthttpclient.java:860) 06-28 18:35:36.442 18638-19939/com.zebra.carcloud.example w/system.err: @ cz.msebera.android.httpclient.impl.client.closeablehttpclient.execute(closeablehttpclient.java:82) 06-28 18:35:36.442 18638-19939/com.zebra.carcloud.example w/system.err: @ com.loopj.android.http.asynchttprequest.makerequest(asynchttprequest.java:146) 06-28 18:35:36.443 18638-19939/com.zebra.carcloud.example w/system.err: @ com.loopj.android.http.asynchttprequest.makerequestwithretries(asynchttprequest.java:177) 06-28 18:35:36.443 18638-19939/com.zebra.carcloud.example w/system.err: @ com.loopj.android.http.asynchttprequest.run(asynchttprequest.java:106) 06-28 18:35:36.443 18638-19939/com.zebra.carcloud.example w/system.err: @ java.util.concurrent.executors$runnableadapter.call(executors.java:423) 06-28 18:35:36.443 18638-19939/com.zebra.carcloud.example w/system.err: @ java.util.concurrent.futuretask.run(futuretask.java:237) 06-28 18:35:36.443 18638-19939/com.zebra.carcloud.example w/system.err: @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1113) 06-28 18:35:36.443 18638-19939/com.zebra.carcloud.example w/system.err: @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:588) 06-28 18:35:36.444 18638-19939/com.zebra.carcloud.example w/system.err: @ java.lang.thread.run(thread.java:818)
i google while couldn't find reason, meet same question me:loopj issues 725, set asynchttpclient timeout 30000(default 10000), , still connecttimeoutexception after 30 seconds.
modify single instance new asynchttpclient instance before second request, every thing ok. don't know whether httpurlconnection operation effects asynchttpclient or not.
Comments
Post a Comment