[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 ...
随机推荐
- tomcat 启动时内存溢出
在tomcat_home/bin目录下找到catalina.bat,用文本编辑器打开,加上下面一行: set JAVA_OPTS= -Xms1024M -Xmx1024M -XX:PermSize=2 ...
- MySQL性能参数详解 - max_connect_errors
max_connect_errors是一个MySQL中与安全有关的计数器值,它负责阻止过多尝试失败的客户端以防止暴力破解密码的情况.max_connect_errors的值与性能并无太大关系. 默认情 ...
- jQuery 鼠标滚轮插件应用 mousewheel
jQuery Mousewheel Plugin,用于添加跨浏览器的鼠标滚轮支持. mousewheel事件的处理函数有一点小小的变化,它除了第一个参数event 外,还接收到第二个参数delta. ...
- MySQL 用户与授权管理详解
大纲 一.前言 二.创建用户并授权 三.GRANT语句的种类 四.撤权并删除用户 一.前言 做为Mysql数据库管理员管理用户账户,是一件很重要的事,指出哪个用户可以连接服务器,从哪里连接,连接后能做 ...
- Hive 安装配置记录
http://yymmiinngg.iteye.com/blog/708230 export HADOOP_HOME_WARN_SUPPRESS=1 export JAVA_HOME=/home/ha ...
- java_queue
队列是一种特殊的线性表,先进先出(first in first out)FIFO,它只允许在表的前端(front)进行删除操作,只允许在表的后端(rear)进行插入操作. 实际应用:排队等待公交车,银 ...
- 对象属性操作-包含kvc---ios
#import <Foundation/Foundation.h> @class Author; @interface Books : NSObject{ @private NSStrin ...
- BEA-WEBLOGIC ---http://www.beansoft.biz/weblogic/docs92/index.html
WebLogic Home 英文对照 发行信息 站点地图 Installation Guide 新增功能 已知和已解决的问题 Upgrade Guide Installing Ma ...
- easyUI之Form(表单)组件
一.对于在easyui中使用的组件,具有输入.输出功能的使用<input>标签,其它的使用<div>标签. 二.对于<input>标签,在使用过程,将name属性和 ...
- ASP.NET MVC报错: Multiple types were found that match the controller named
当使用ASP.NET MVC的Area功能时,出现了这样的错误: Multiple types were found that match the controller named 'Home'. T ...