[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 ...
随机推荐
- leetcode 128. Longest Consecutive Sequence ----- java
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. F ...
- 工作中遇到的问题--缓存配置(使用@Configuration装配 @Bean的方式注入)
@EnableCaching@Configurationpublic class MFGCachingConfiguration { @Autowired private MFGSettings mf ...
- Codeforces Round #134 (Div. 2)
A. Mountain Scenery 枚举山顶位置,满足\(r_{i-1} \lt r_i - 1 \gt r_{i+1}\). 范围要开\(2N\). B. Airport 优先队列维护最值. C ...
- 1-2 ISO/OSI七层模型简介
相关名词解释: ISO:国际标准化组织 OSI:开放系统互联模型 IOS:苹果操作系统, 但是在计算机网络中,IOS是互联网操作系统,是思科公司为其网络设备开发的操作维护系统 <1>OSI ...
- hihoCoder#1014 Trie树 (前缀树)
题目大意:给一本有n个单词的词典,有m次询问,每次询问的是该词典中有多少个单词有共同的某个前缀. 题目分析:在添加单词建立trie的时候,每经过一个节点就意味着该节点和它的各级祖先节点是某个单词的前缀 ...
- (转) 实时SLAM的未来及与深度学习的比较
首页 视界智尚 算法技术 每日技术 来打我呀 注册 实时SLAM的未来及与深度学习的比较 The Future of Real-Time SLAM and “Deep Learni ...
- EXTJS 5.0 资料
http://blog.csdn.net/sushengmiyan/article/category/2435029
- jQuery Ajax请求提交 后台getParameter接收不到数据
今天遇到的问题,总结一下 jQuery的$ajax({ contentType:"application/json", //发送信息至服务器时内容编码类型. }) 这样的方式提交 ...
- SQL Server 索引分类
什么是索引 拿汉语字典的目录页(索引)打比方:正如汉语字典中的汉字按页存放一样,SQL Server中的数据记录也是按页存放的,每页容量一般为4K .为了加快查找的速度,汉语字(词)典一般都有按拼音. ...
- js跳转到页面中指定的hash
location.hash = "#filter_moreClue";