AsyncTask, RejectedExecutionException and Task Limit
2012-05-28 10:48
330 查看
I am fetching lots of thumbnails from a remote server and displaying them in a grid view, using AsyncTask. The problem is, my grid view displays 20 thumbnails at a time, so that creates 20 AsyncTasks and starts 20 executes, one per thumbnail.
I get
in my code. I recall reading somewhere that there is a limit to number of tasks that AsyncTask can have in its queue at a time, i might be hitting that. Was this bar lifted?
Is there a way to increase this limit? Is it safe to just ignore this exception?(by having an empty
I am running this code on Android 1.6 emulator and the API level in my code(minSDKVersion is 3). [EDIT: Added SDK and API level info]
I recall reading somewhere that there is a limit to number of tasks that AsyncTask can have in its queue at a time, i might be hitting that. Was this bar lifted?
to presently support 10 threads and a work queue depth of 10. In theory, that would just support 20 items...if nothing else is using
Is there a way to increase this limit?
Grab the source code, modify it, put it in your own package, and use that one. I did this with my
though that is based on the Android 1.5 source.
Is it safe to just ignore this exception?
Your work will not be queued for execution. Whether that is "safe" is up to you. I am not aware of any other impacts on the
I get
RejectedExecutionexception
in my code. I recall reading somewhere that there is a limit to number of tasks that AsyncTask can have in its queue at a time, i might be hitting that. Was this bar lifted?
Is there a way to increase this limit? Is it safe to just ignore this exception?(by having an empty
catch(RejectedException e){}block?)
I am running this code on Android 1.6 emulator and the API level in my code(minSDKVersion is 3). [EDIT: Added SDK and API level info]
I recall reading somewhere that there is a limit to number of tasks that AsyncTask can have in its queue at a time, i might be hitting that. Was this bar lifted?
AsyncTaskappears
to presently support 10 threads and a work queue depth of 10. In theory, that would just support 20 items...if nothing else is using
AsyncTask.
Is there a way to increase this limit?
Grab the source code, modify it, put it in your own package, and use that one. I did this with my
AsyncTaskEx,
though that is based on the Android 1.5 source.
Is it safe to just ignore this exception?
Your work will not be queued for execution. Whether that is "safe" is up to you. I am not aware of any other impacts on the
AsyncTaskinfrastructure.
相关文章推荐
- 解决AsyncTask引发的RejectedExecutionException
- Executor 线程池由于task被hold住抛出RejectedExecutionException
- 解决AsyncTask引发的RejectedExecutionException
- 解决AsyncTask引发的RejectedExecutionException(继承AsynTask)
- 解决AsyncTask引发的RejectedExecutionException
- Android_AsyncTask详解及其应用(二 )_RejectedExecutionException问题
- 解决AsyncTask引发的RejectedExecutionException
- Android_AsyncTask详解及其应用(二 )_RejectedExecutionException问题
- 解决AsyncTask引发的RejectedExecutionException
- java.util.concurrent.RejectedExecutionException for multi AsyncTask
- java.util.concurrent.RejectedExecutionException 线程池饱和
- java.util.concurrent.RejectedExecutionException: event executor terminated解决方法之一
- org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected be
- Error:Execution failed for task ':app:buildInfoDebugLoader'. > Exception while doing past iteration
- 记一次Error:Execution failed for task ':o2osdk:transformClassesAndResourcesWithProguardForRelease'编译出错
- Execution failed for task ':app:installDebug'. > com.android.builder.testing.api.DeviceException:
- 混淆bug:* What went wrong: Execution failed for task ':app:transformClassesAndResourcesWithProguardFor
- Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException:
- Error:Execution failed for task ':app:buildInfoDebugLoader'. > Exception while doing past iteration
- Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.