本文整理汇总了Java中android.os.AsyncTask.THREAD_POOL_EXECUTOR属性的典型用法代码示例。如果您正苦于以下问题:Java AsyncTask.THREAD_POOL_EXECUTOR属性的具体用法?Java AsyncTask.THREAD_POOL_EXECUTOR怎么用?Java AsyncTask.THREAD_POOL_EXECUTOR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.os.AsyncTask
的用法示例。
在下文中一共展示了AsyncTask.THREAD_POOL_EXECUTOR属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExecutor
/**
* Returns the Executor used by the SDK for non-AsyncTask background work.
*
* By default this uses AsyncTask Executor via reflection if the API level is high enough.
* Otherwise this creates a new Executor with defaults similar to those used in AsyncTask.
*
* @return an Executor used by the SDK. This will never be null.
*/
public static Executor getExecutor() {
synchronized (LOCK) {
if (FacebookSdk.executor == null) {
FacebookSdk.executor = AsyncTask.THREAD_POOL_EXECUTOR;
}
}
return FacebookSdk.executor;
}
示例2: getCurrentExecutor
public Executor getCurrentExecutor() {
final DocumentInfo cwd = getCurrentDirectory();
if (cwd != null && cwd.authority != null) {
return ProviderExecutor.forAuthority(cwd.authority);
} else {
return AsyncTask.THREAD_POOL_EXECUTOR;
}
}
示例3: getExecutor
public static Executor getExecutor() {
synchronized (LOCK) {
if (executor == null) {
executor = AsyncTask.THREAD_POOL_EXECUTOR;
}
}
return executor;
}
示例4: KanboardAPI
public KanboardAPI(String serverURL, final String username, final String password) throws IOException {
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password.toCharArray());
}
});
kanboardURL = KanboardAPI.sanitizeURL(serverURL.trim());
Log.i(Constants.TAG, String.format("Host uses %s", kanboardURL.getProtocol()));
// threadPoolExecutor = new ThreadPoolExecutor(12, 12, 20, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(256));
threadPoolExecutor = (ThreadPoolExecutor) AsyncTask.THREAD_POOL_EXECUTOR;
threadPoolExecutor.setCorePoolSize(12);
threadPoolExecutor.setMaximumPoolSize(12);
}
示例5: build
/**
* Generates the {@link BittrexApiClient}
* @return A {@link BittrexApiClient}
*/
@NonNull
public BittrexApiClient build() {
if (downloader == null) {
downloader = new UrlConnectionDownloader();
}
if (executor == null) {
executor = AsyncTask.THREAD_POOL_EXECUTOR;
}
return new BittrexApiClient(this);
}
示例6: executeTask
public void executeTask(Input... params) {
if (workMode == WorkMode.SYNCHRONOUS) {
onPreExecute();
onPostExecute(doInBackground(params));
} else {
super.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
}
}
示例7: executeInPool
public void executeInPool(Params... values) {
super.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, values);
}
示例8: AsyncTaskLoader
public AsyncTaskLoader(Context context) {
this(context, AsyncTask.THREAD_POOL_EXECUTOR);
}
示例9: getThreadPool
public static Executor getThreadPool() {
return AsyncTask.THREAD_POOL_EXECUTOR;
}
示例10: PoolSerialExecutor
public PoolSerialExecutor() {
this(AsyncTask.THREAD_POOL_EXECUTOR);
}
示例11: getParallelExecutor
public static Executor getParallelExecutor() {
return AsyncTask.THREAD_POOL_EXECUTOR;
}