igreenwood/SimpleCropView

java.util.concurrent.RejectedExecutionException:

TopTime1 opened this issue · 9 comments

java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@4f4343f rejected from java.util.concurrent.ThreadPoolExecutor@b9fa10c[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 4]
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2014)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:794)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1340)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:82)
at java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:594)
at com.isseiaoki.simplecropview.CropImageView.saveAsync(CropImageView.java:1828)
at com.isseiaoki.simplecropview.SaveRequest.execute(SaveRequest.java:41)
at com.ikongjian.activity.CutActivity$2.onSuccess(CutActivity.java:173)
at com.isseiaoki.simplecropview.CropImageView$10$1.run(CropImageView.java:1763)
at android.os.Handler.handleCallback(Handler.java:743)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)

I too got same exception in save callback method

I solve by limiting the number of Click Save, its internal thread pool is a single line pool

will u plz let me know what to do and where to do? bcz i m new to this library and have deadline.
some times getting exceptions and some times no exception at all.

@TopTime1 Can you share the solution?

Click the save post gray button to prevent multiple clicks.

What's post gray button?

button.setEnabled(false);save completion and then set it to true.

I'm tried but not working for me.

     @Override
    public void onClick(View v) {
     ...
     ...    
        case R.id.imgPaylas:
                imgPaylas.setEnabled(false); btnCrop.setEnabled(true);
                ((MainActivity)getAct()).setToolbarName(getAct().getString(R.string.duzenle));
                dorper=true;
                final Uri uris =takeScreenShot(dorper);
                croppedImage.load(uris).execute(mLoadCallback);
                break;

            case R.id.btnUsePicture:
                btnCrop.setEnabled(false); imgPaylas.setEnabled(true);
                saveUri = Util.createNewUri(getContext(),format);
                croppedImage.crop(path)
                        .outputWidth((int) (getWidth()/1.05))
                        .execute(mCropCallback);
                break;
}

I did it in the form of "task java.util.concurrent.FutureTask@e9a5deb rejected from java.util.concurrent.ThreadPoolExecutor@f19c748 [Terminated, pool size = 0]
         at java.util.concurrent.ThreadPoolExecutor $ AbortPolicy.rejectedExecution (ThreadPoolExecutor.java:2049) "
is returning the error.

@mlnkrish @tinsukE @TopTime1