android批量上传图片,20张以上必出现失败几率


业务需求批量上传图片,图片大概一张4M左右,上传10张以下没问题,但是上传10张以上就会出现失败的情况;
错误1:
I/qiniu----failed﹕ {ResponseInfo:com.qiniu.android.http.ResponseInfo@42ce1ba8,status:-1, reqId:null, xlog:null,error:UnknownHostException exception: Unable to resolve host "upload.qiniu.com": No address associated with hostname}

错误2:
Passed contentType will be ignored because HttpEntity sets content type

org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection
05-27 11:26:08.936 7268-7683/com.baijimu.engineering W/System.err﹕ at org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(ConnPoolByRoute.java:353)
05-27 11:26:08.946 7268-7683/com.baijimu.engineering W/System.err﹕ at org.apache.http.impl.conn.tsccm.ConnPoolByRoute$1.getPoolEntry(ConnPoolByRoute.java:238)

请问这是什么情况?

Android

恒恒恒恒恒。 9 years, 10 months ago

看你的日志应该是连接超时,应该是并发连接数过高的问题,建议在上传的时候使用队列和线程池的方式,减少并发连接。

leonly answered 9 years, 10 months ago

Your Answer