Class InvokerStrategy
- java.lang.Object
-
- org.apache.maven.surefire.junitcore.pc.SchedulingStrategy
-
- org.apache.maven.surefire.junitcore.pc.InvokerStrategy
-
- All Implemented Interfaces:
Destroyable
final class InvokerStrategy extends SchedulingStrategy
The sequentially executing strategy in private package.- Since:
- 2.16
- See Also:
SchedulingStrategy
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Queue<java.lang.Thread>activeThreads
-
Constructor Summary
Constructors Modifier Constructor Description protectedInvokerStrategy(ConsoleStream logger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandestroy()CallingThreadPoolExecutor.shutdown()andThreadPoolExecutor.awaitTermination(long, java.util.concurrent.TimeUnit).booleanfinished()Waiting for scheduled tasks to finish.booleanhasSharedThreadPool()voidschedule(java.lang.Runnable task)Schedules tasks ifSchedulingStrategy.canSchedule().protected booleanstop()Stops scheduling new tasks (e.g.protected booleanstopNow()Stops scheduling new tasks andinterruptsrunning tasks (e.g.-
Methods inherited from class org.apache.maven.surefire.junitcore.pc.SchedulingStrategy
canSchedule, disable, logQuietly, setDefaultShutdownHandler
-
-
-
-
Constructor Detail
-
InvokerStrategy
protected InvokerStrategy(ConsoleStream logger)
-
-
Method Detail
-
schedule
public void schedule(java.lang.Runnable task)
Description copied from class:SchedulingStrategySchedules tasks ifSchedulingStrategy.canSchedule().- Specified by:
schedulein classSchedulingStrategy- Parameters:
task- runnable to schedule in a thread pool or invoke- See Also:
RunnerScheduler.schedule(Runnable),Executor.execute(Runnable)
-
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).- Specified by:
stopin classSchedulingStrategy- 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 classSchedulingStrategy- Returns:
trueif successfully stopped the scheduler, elsefalseif already stopped (a shared thread pool was shutdown externally).- See Also:
ExecutorService.shutdownNow()
-
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()
-
destroy
public boolean destroy()
Description copied from interface:DestroyableCallingThreadPoolExecutor.shutdown()andThreadPoolExecutor.awaitTermination(long, java.util.concurrent.TimeUnit).- Returns:
trueif not interrupted in current thread
-
-