所以我被困在一个非常基本的 Java 事情上。
即我有一个iteration需要在inner class完成后进入下一个循环。但是由于inner class需要很多时间并且variables可以访问的inner class必须是final它抛出我RejectedExecutionException。
java.util.concurrent.RejectedExecutionException: Task android.os.AsyncTask$3@290074 rejected from java.util.concurrent.ThreadPoolExecutor@d50b99d[Running, pool size = 17, active threads = 17, queued tasks = 128, completed tasks = 42]
这是引发异常的简化解决方案。
for (int i = 0; i < 10;i++) {
String[] cmd = { "-i", imageToBeFiltered.toString(), "-filter_complex", filters[loopCounter], imageWithFilter.toString()};
ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {
@Override
public void onSuccess(String message) {
super.onSuccess(message);
//Continue loop only if it has reached onSuccess or onFailure
}
@Override
public void onFailure(String message) {
super.onFailure(message);
//Continue loop only if it has reached onSuccess or onFailure
}
});
}
}
当做正常时,fori-loop它并不总是等待所有terminal calls完成并继续。
森栏
相关分类