/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.flowable.common.engine.impl.async;

import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.RejectedExecutionException;

import org.flowable.common.engine.api.async.AsyncTaskExecutor;

/**
 * @author Filip Hrisafov
 */
public class DefaultAsyncTaskInvoker implements AsyncTaskInvoker {

    protected final AsyncTaskExecutor taskExecutor;

    public DefaultAsyncTaskInvoker(AsyncTaskExecutor taskExecutor) {
        this.taskExecutor = taskExecutor;
    }

    @Override
    public <T> Future<T> submit(Callable<T> task) {
        try {
            return taskExecutor.submit(task);
        } catch (RejectedExecutionException rejected) {
            // If the task was rejected then run it on the current thread
            FutureTask<T> futureTask = new FutureTask<>(task);
            futureTask.run();
            return futureTask;
        }
    }
}

@@ -834,16 +834,73 @@
 xecutor;
+%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;
 %0A%0A/**%0A *
@@ -995,16 +995,90 @@
 oker %7B%0A%0A
+    protected final Logger logger = LoggerFactory.getLogger(getClass());%0A%0A
     prot
@@ -1438,22 +1438,29 @@
     
-// If the t
+logger.debug(%22T
 ask
+ %7B%7D
  was
@@ -1472,20 +1472,29 @@
 cted
- then run it
+. It will be executed
  on 
@@ -1511,16 +1511,36 @@
 t thread
+.%22, task, rejected);
 %0A       

Add logging in the DefaultAsyncTaskInvoker