How to add custom check in executorService.submit() callback.
I want my thread not to do anything, whenever flag is true. If flag is false then it should work as usual.

```
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class test{
    private static volatile boolean flag= false;
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Callable<Boolean> callableTask = () -> {
            return isFlag();
        };
        Future a = submitAsync(callableTask);
        System.out.println("tartest"+a.get());
    }
    public static  Future submitAsync(Callable taskToRun) {
        ExecutorService e1 =  Executors.newSingleThreadExecutor(new BasicThreadFactory.Builder().namingPattern("").build());
        return e1.submit(() -> {
            try {
                if (flag) {
                    return;
                }
                taskToRun.call();
            } catch (Exception e) {
                System.out.println("garbage ---");
            }
        });
        // return e1.submit(taskToRun);
    }
    public static boolean isFlag() {
        return true;
    }
}

```

Here, a.get() is returning null. If I replace e1.submit(....) with e1.submit(taskToRun), which is commented in given code snippet then its working fine. So why a.get() is null?