Class SharedThreadPoolStrategy
- java.lang.Object
-
- org.apache.maven.surefire.junitcore.pc.SchedulingStrategy
-
- org.apache.maven.surefire.junitcore.pc.AbstractThreadPoolStrategy
-
- org.apache.maven.surefire.junitcore.pc.SharedThreadPoolStrategy
-
- All Implemented Interfaces:
Destroyable
final class SharedThreadPoolStrategy extends AbstractThreadPoolStrategy
Parallel strategy for shared thread pool in private package.- Since:
- 2.16
- See Also:
AbstractThreadPoolStrategy
-
-
Constructor Summary
Constructors Constructor Description SharedThreadPoolStrategy(ConsoleStream logger, java.util.concurrent.ExecutorService threadPool)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanfinished()Waiting for scheduled tasks to finish.booleanhasSharedThreadPool()protected booleanstop()Stops scheduling new tasks (e.g.private booleanstop(boolean interrupt)protected booleanstopNow()Stops scheduling new tasks andinterruptsrunning tasks (e.g.-
Methods inherited from class org.apache.maven.surefire.junitcore.pc.AbstractThreadPoolStrategy
destroy, getFutureResults, getThreadPool, schedule, setDefaultShutdownHandler
-
Methods inherited from class org.apache.maven.surefire.junitcore.pc.SchedulingStrategy
canSchedule, disable, logQuietly
-
-
-
-
Constructor Detail
-
SharedThreadPoolStrategy
SharedThreadPoolStrategy(ConsoleStream logger, java.util.concurrent.ExecutorService threadPool)
-
-
Method Detail
-
hasSharedThreadPool
public boolean hasSharedThreadPool()
- Specified by:
hasSharedThreadPoolin classSchedulingStrategy- Returns:
trueif a thread pool associated with this strategy can be shared with other strategies.
-
finished
public boolean finished() throws java.lang.InterruptedExceptionDescription copied from class:SchedulingStrategyWaiting for scheduled tasks to finish. New tasks will not be scheduled by calling this method.- Specified by:
finishedin classSchedulingStrategy- Returns:
trueif successfully stopped the scheduler, elsefalseif already stopped (a shared thread pool was shutdown externally).- Throws:
java.lang.InterruptedException- if interrupted while waiting for scheduled tasks to finish- See Also:
RunnerScheduler.finished()
-
stop
protected boolean stop()
Description copied from class:SchedulingStrategyStops scheduling new tasks (e.g. byExecutorService.shutdown()on a private thread pool which cannot be shared with other strategy).- Overrides:
stopin classAbstractThreadPoolStrategy- Returns:
trueif successfully stopped the scheduler, elsefalseif already stopped (a shared thread pool was shutdown externally).- See Also:
ExecutorService.shutdown()
-
stopNow
protected boolean stopNow()
Description copied from class:SchedulingStrategyStops scheduling new tasks andinterruptsrunning tasks (e.g. byExecutorService.shutdownNow()on a private thread pool which cannot be shared with other strategy).
This method callsSchedulingStrategy.stop()by default.- Overrides:
stopNowin classAbstractThreadPoolStrategy- Returns:
trueif successfully stopped the scheduler, elsefalseif already stopped (a shared thread pool was shutdown externally).- See Also:
ExecutorService.shutdownNow()
-
stop
private boolean stop(boolean interrupt)
-
-