[Android Exception 1A] -com.android.volley.NoConnectionError: java.io.InterruptedIOException
- ::47.470 -/com.tongyan.tutelage W/System.err: com.android.volley.NoConnectionError: java.io.InterruptedIOException
- ::47.470 -/com.tongyan.tutelage W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:)
- ::47.470 -/com.tongyan.tutelage W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:)
- ::47.470 -/com.tongyan.tutelage W/System.err: Caused by: java.io.InterruptedIOException
- ::47.470 -/com.tongyan.tutelage W/System.err: at com.android.okio.Deadline.throwIfReached(Deadline.java:)
- ::47.470 -/com.tongyan.tutelage W/System.err: at com.android.okio.Okio$.write(Okio.java:)
- ::47.470 -/com.tongyan.tutelage W/System.err: at com.android.okio.RealBufferedSink.flush(RealBufferedSink.java:)
- ::47.470 -/com.tongyan.tutelage W/System.err: at com.android.okhttp.internal.http.HttpConnection.flush(HttpConnection.java:)
- ::47.470 -/com.tongyan.tutelage W/System.err: at com.android.okhttp.internal.http.HttpTransport.flushRequest(HttpTransport.java:)
- ::47.470 -/com.tongyan.tutelage W/System.err: at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:)
- ::47.470 -/com.tongyan.tutelage W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:)
- ::47.470 -/com.tongyan.tutelage W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:)
- ::47.470 -/com.tongyan.tutelage W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:)
- ::47.470 -/com.tongyan.tutelage W/System.err: at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:)
- ::47.470 -/com.tongyan.tutelage W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:)
- ::47.470 -/com.tongyan.tutelage W/System.err: ... more
这个错误是你在不经意间导致的,或者是没有很好的去熟悉volley包的api导致的。
public void onRequest(String url){
if(isIntnetConn){
StringRequest request = new StringRequest(url, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
mListener.onSuccess(s);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
String errorMsg = "";
if(volleyError instanceof TimeoutError) {
mListener.onError();
} else if(volleyError instanceof ServerError) {
mListener.onError();
} else {
mListener.onError();
errorMsg = mContext.getResources().getString(R.string.request_error);
}
}
});
request.setRetryPolicy(new DefaultRetryPolicy( * , , 1.0f));//设置超时时间
mQueue.add(request);
//mQueue.start();
}else{
Toast.makeText(mContext, "当前的网络连接不可用", Toast.LENGTH_SHORT).show();
mListener.onIntnetDisConn();
}
}
只是因为加了下面这句,bug如期而至。
//mQueue.start();
其实,在RequestQueue实例化的时候,就已经有start了。
private RequestQueue mQueue;
private Context mContext; public HttpServiceUtils(HttpResquestListener listener,Context context){
mListener = listener;
mContext = context;
mQueue = Volley.newRequestQueue(context);
}
public class Volley {
private static final String DEFAULT_CACHE_DIR = "volley"; public Volley() {
} public static RequestQueue newRequestQueue(Context context, HttpStack stack) {
File cacheDir = new File(context.getCacheDir(), "volley");
String userAgent = "volley/0"; try {
String network = context.getPackageName();
PackageInfo queue = context.getPackageManager().getPackageInfo(network, );
userAgent = network + "/" + queue.versionCode;
} catch (NameNotFoundException var6) {
;
} if(stack == null) {
if(VERSION.SDK_INT >= ) {
stack = new HurlStack();
} else {
stack = new HttpClientStack(AndroidHttpClient.newInstance(userAgent));
}
} BasicNetwork network1 = new BasicNetwork((HttpStack)stack);
RequestQueue queue1 = new RequestQueue(new DiskBasedCache(cacheDir), network1);
queue1.start();
return queue1;
} public static RequestQueue newRequestQueue(Context context) {
return newRequestQueue(context, (HttpStack)null);
}
}
queue1.start(); 已经在实例化RequestQueue的时候,就被调用了。
https://stackoverflow.com/questions/31158858/random-com-android-volley-noconnection-error-java-io-interruptedioexception-st/31181611#31181611
[Android Exception 1A] -com.android.volley.NoConnectionError: java.io.InterruptedIOException的更多相关文章
- 严重: Exception loading sessions from persistent storage Java.io.EOFException
tomcat启动时报此异常,但web页均能正常运行:对程序影响不大. /*具体原因时tomcat--work--(你当前运行的工程名)--session.ser*/删除即可解决 分析: EOFExce ...
- java.io.EOFException
错误代码如下: 严重: IOException while loading persisted sessions: java.io.EOFException java.io.EOFException ...
- org.apache.hadoop.ipc.RemoteException(java.io.IOException)
昨晚突然之间mr跑步起来了 jps查看 进程都在的,但是在reduce任务跑了85%的时候会抛异常 异常情况如下: 2016-09-21 21:32:28,538 INFO [org.apache.h ...
- tomcat启动报错:IOException while loading persisted sessions: java.io.EOFException.
tomcat启动错误代码: 严重: IOException while loading persisted sessions: java.io.EOFException java.io.EOFExce ...
- tomcat启动时报:IOException while loading persisted sessions: java.io.EOFException的解决方案
错误代码如下: 严重: IOException while loading persisted sessions: java.io.EOFException java.io.EOFException ...
- hive运行query语句时提示错误:org.apache.hadoop.ipc.RemoteException: java.io.IOException: java.io.IOException:
hive> select product_id, track_time from trackinfo limit 5; Total MapReduce jobs = 1 Launching Jo ...
- java IO流全面总结
流的概念和作用 流是一组有顺序的,有起点和终点的字节集合,是对数据传输的总称或抽象.即数据在两设备间的传输称为流,流的本质是数据传输,根据数据传输特性将流抽象为各种类,方便更直观的进行数据操作. Ja ...
- tomcat启动时报:IOException while loading persisted sessions: java.io.EOFException的解决方案 ZT
错误代码如下: 严重: IOException while loading persisted sessions: java.io.EOFException java.io.EOFException ...
- 启动项目时出现java.io.EOFException异常。
错误: 2018-4-18 10:55:54 org.apache.catalina.session.StandardManager doLoad 严重: IOException while load ...
随机推荐
- poj1680 最短路判环
题意:有多个银行可以换钱,每个银行可以将特定的两种钱相互兑换,并且有自己的汇率,现在问是否可以将自己的钱通过银行兑换增加. 其实比较水,主要就是知道最短路问题里的负环可以通过bellman-fold或 ...
- Linux常用配置文件解析
网络相关配置文件 1./etc/sysconfig/network-scripts/ifcfg-ethx 网络参数IP/子网掩码/广播地址等的配置(重启有效) 2./etc/resolv.conf ...
- Clr core
http://hllvm.group.iteye.com/group/topic/43559
- UIPageControl简单使用
1.添加一个UIPageControl到view中 -(void)addPageControl { UIPageControl* page=[[UIPageControl alloc]init]; p ...
- 虚拟化之vmware虚拟机扩容与克隆
前提条件: 1.在新建虚拟机的时候创建磁盘如下图,之后这个磁盘就可以在虚拟机关机状态下动态扩展大小,否则只能通过添加另外一块硬盘的方式来扩容.
- linux工具之log4j-LogBack-slf4j-commons-logging
log4j http://commons.apache.org/proper/commons-logging/ http://logging.apache.org/log4j/2.x/ The Com ...
- sublime个人快捷键
ctrl+alt+f = 代码格式化(html,js) ctrl+d = 选中相同内容 alt+shift+w = 为内容添加新标签 ctrl+shift+a = 选择标签内的内容(再按一 ...
- css之cursor,float
鼠标形状: 在html中可以任意定义各个标签的显示形状,也可以此用来做些标签显示假像. <body> <p style="cursor: pointer"> ...
- Swift使用Alamofire实现网络请求
Alamofire是一个用Swift编写的HTTP网络库,由此前热门开源项目AFNetworking的的作者mattt开发,可非常简单地用于异步网络通信. 要获取最新版本的 Alamofire,前往h ...
- ManagementFactory cannot be resolved
ManagementFactory cannot be resolved 问题描述: (1)ManagementFactory cannot be resolved or (2)Type The ty ...