We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在Android操作系统中,一般会更具cpu的核心数来定义并发线程的数量,所以TaskQueue如果使用自动以的线程池可否这样设置:TaskQueue.getDefault().setExecutor(...); 看文档上写的是TaskQueue.createNew().setExecutor(...);这样TaskQueue就不是单例了; 我想请教作者,如果我想用自定义的线程池而且想用单例那么这么设置TaskQueue.getDefault().setExecutor(...)不会有错吧?
The text was updated successfully, but these errors were encountered:
@brucewuu520
两种用法是等价的,如果整个应用都只用一个TaskQueue,那么随便选一种都可以
例子:
public class MyApp extends Application { private TaskQueue mQueue; @Override public void onCreate() { super.onCreate(); mQueue = TaskQueue.createNew(); mQueue.setExecutor(Executors.newFixedThreadPool(2)); } public TaskQueue getQueue() { return mQueue; } }
// 对于情况一 TaskQueue queue=TaskQueue.getDefault(); // 对于情况二 MyApp app=(MyApp) context.getApplicationContext(); TaskQueue queue=app.getQueue();
Sorry, something went wrong.
close
No branches or pull requests
在Android操作系统中,一般会更具cpu的核心数来定义并发线程的数量,所以TaskQueue如果使用自动以的线程池可否这样设置:TaskQueue.getDefault().setExecutor(...);
看文档上写的是TaskQueue.createNew().setExecutor(...);这样TaskQueue就不是单例了;
我想请教作者,如果我想用自定义的线程池而且想用单例那么这么设置TaskQueue.getDefault().setExecutor(...)不会有错吧?
The text was updated successfully, but these errors were encountered: