67,513
社区成员
发帖
与我相关
我的任务
分享
public abstract class AbsBaseProvider {
private final BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<Runnable>();
private final ThreadPoolExecutor mThreadPool = new ThreadPoolExecutor(5, 20, 20, TimeUnit.SECONDS, workQueue);
protected synchronized void loadData(DataContext dc, String url) {
mThreadPool.execute(new OTGInteractive(dc, url));
mThreadPool.shutdown();
// new Thread(new Interactive(dc, url)).start();
}
private class Interactive implements Runnable {
private final DataContext dc;
private final String url;
public OTGInteractive(DataContext dc, String url) {
this.dc = dc;
this.url = url;
}
@Override
public void run() {
try {
System.out.println("test…...");
} catch (Exception e) {
if (e instanceof AppException) {
}
else {
}
if (mListener != null) {
mListener.onServerError();
}
sLogger.e("error", e.toString());
e.printStackTrace();
}
});
}
}
}