There's a thread pool with a single thread that is used to perform tasks submitted by multiple threads. The task is actually comprised of two parts - `perform` with meaningful result and `cleanup` that takes quite some time but returns no meaningful result. At the moment (obviously incorrect) implementation looks something like this. Is there an elegant way to ensure that another `perform` task will be executed only after previous `cleanup` task?

```
public class Main {
    private static class Worker {
        int perform() {
            return 1;
        }

        void cleanup() {
        }
    }

    private static void perform() throws InterruptedException, ExecutionException {
        ExecutorService pool = Executors.newFixedThreadPool(1);
        Worker w = new Worker();
        Future f = pool.submit(() -> w.perform());
        pool.submit(w::cleanup);
        int x = (int) f.get();
        System.out.println(x);
    }
}

```