Class CleanableExecutor

  • All Implemented Interfaces:
    Executor, ExecutorService

    public final class CleanableExecutor
    extends Object
    implements ExecutorService
    An executor that can be 'cleaned'. Each clean increments an internal generation number. When a task is executed by a thread that has a different generation number to the last task executed by the thread then the threads ThreadLocal's will be cleared. This means that thread locals from a previous deployment cannot interfere with the current deployment. This is only for development mode, it must not be used for production applications. TODO: should this just provide a facade that simply starts a new thread pool instead?