All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.vpro.util.ThreadPoolShutdowner Maven / Gradle / Ivy

There is a newer version: 5.3.1
Show newest version
package nl.vpro.util;

import lombok.extern.log4j.Log4j2;
import org.junit.platform.launcher.TestExecutionListener;
import org.junit.platform.launcher.TestPlan;

import java.util.concurrent.ForkJoinPool;

/**
 * A junit TestExecutionListener that just makes sure that all ThreadPools are shutdown after the tests.
 */
@Log4j2
public class ThreadPoolShutdowner implements TestExecutionListener {

    @Override
    public void testPlanExecutionFinished(TestPlan testPlan) {
        ThreadPools.shutdown();
        log.info("Shutting down ForkJoinPool.commonPool() too");
        ForkJoinPool.commonPool().shutdown();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy