Class ForkStarter
java.lang.Object
org.apache.maven.plugin.surefire.booterclient.ForkStarter
Starts the fork or runs in-process.
Lives only on the plugin-side (not present in remote vms)
Knows how to fork new vms and also how to delegate non-forking invocation to SurefireStarter directly
Lives only on the plugin-side (not present in remote vms)
Knows how to fork new vms and also how to delegate non-forking invocation to SurefireStarter directly
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final class
Closes stuff, with a shutdown hook to make sure things really get closed.private final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Queue<ForkClient>
private final Collection<DefaultReporterFactory>
private static final String
private final ForkConfiguration
private static final ThreadFactory
private final int
private final ConsoleLogger
private static final long
private final ScheduledExecutorService
private final ProviderConfiguration
private final ReportsMerger
private static final ThreadFactory
private final StartupConfiguration
private final StartupReportConfiguration
private static final AtomicInteger
private static final int
private final ScheduledExecutorService
-
Constructor Summary
ConstructorsConstructorDescriptionForkStarter
(ProviderConfiguration providerConfiguration, StartupConfiguration startupConfiguration, ForkConfiguration forkConfiguration, int forkedProcessTimeoutInSeconds, StartupReportConfiguration startupReportConfiguration, ConsoleLogger log) -
Method Summary
Modifier and TypeMethodDescriptionprivate static RunResult
awaitResultsDone
(Collection<Future<RunResult>> results, ExecutorService executorService) private static Stoppable
bindErrorStream
(int forkNumber, CountdownCloseable countdownCloseable, CommandlineStreams streams, Object errorStreamLock) private void
closeExecutor
(ExecutorService executorService) private static Thread
createCachableShutdownHookThread
(TestLessInputStream.TestLessInputStreamBuilder builder, Shutdown shutdownType) private static Thread
createImmediateShutdownHookThread
(TestLessInputStream.TestLessInputStreamBuilder builder, Shutdown shutdownType) private static ScheduledExecutorService
private static Thread
createShutdownHookThread
(Iterable<TestProvidingInputStream> streams, Shutdown shutdownType) private static ScheduledExecutorService
private RunResult
fork
(Object testSet, PropertiesWrapper providerProperties, ForkClient forkClient, SurefireProperties effectiveSystemProperties, int forkNumber, AbstractCommandReader commandReader, ForkNodeFactory forkNodeFactory, boolean readTestsFromInStream) private boolean
private boolean
void
private static void
notifyStreamsToSkipTests
(Collection<? extends NotifiableTestStream> notifiableTestStreams) private RunResult
run
(SurefireProperties effectiveSystemProperties) private RunResult
run
(SurefireProperties effectiveSystemProps, Map<String, String> providerProperties) run
(SurefireProperties effectiveSystemProperties, DefaultScanResult scanResult) private RunResult
runSuitesForkOnceMultiple
(SurefireProperties effectiveSystemProps, int forkCount) private RunResult
runSuitesForkPerTestSet
(SurefireProperties effectiveSystemProps, int forkCount) private ScheduledFuture<?>
private ScheduledFuture<?>
private ScheduledFuture<?>
-
Field Details
-
EXECUTION_EXCEPTION
- See Also:
-
PING_IN_SECONDS
private static final long PING_IN_SECONDS- See Also:
-
TIMEOUT_CHECK_PERIOD_MILLIS
private static final int TIMEOUT_CHECK_PERIOD_MILLIS- See Also:
-
FORKED_JVM_DAEMON_THREAD_FACTORY
-
SHUTDOWN_HOOK_THREAD_FACTORY
-
SYSTEM_PROPERTIES_FILE_COUNTER
-
logsAtEnd
-
pingThreadScheduler
-
timeoutCheckScheduler
-
currentForkClients
-
forkedProcessTimeoutInSeconds
private final int forkedProcessTimeoutInSeconds -
providerConfiguration
-
startupConfiguration
-
forkConfiguration
-
startupReportConfiguration
-
log
-
reportMerger
-
defaultReporterFactories
-
-
Constructor Details
-
ForkStarter
public ForkStarter(ProviderConfiguration providerConfiguration, StartupConfiguration startupConfiguration, ForkConfiguration forkConfiguration, int forkedProcessTimeoutInSeconds, StartupReportConfiguration startupReportConfiguration, ConsoleLogger log)
-
-
Method Details
-
run
public RunResult run(@Nonnull SurefireProperties effectiveSystemProperties, @Nonnull DefaultScanResult scanResult) throws SurefireBooterForkException - Throws:
SurefireBooterForkException
-
killOrphanForks
public void killOrphanForks() -
run
private RunResult run(SurefireProperties effectiveSystemProps, Map<String, String> providerProperties) throws SurefireBooterForkException- Throws:
SurefireBooterForkException
-
run
private RunResult run(SurefireProperties effectiveSystemProperties) throws SurefireBooterForkException - Throws:
SurefireBooterForkException
-
isForkOnce
private boolean isForkOnce() -
hasSuiteXmlFiles
private boolean hasSuiteXmlFiles() -
runSuitesForkOnceMultiple
private RunResult runSuitesForkOnceMultiple(SurefireProperties effectiveSystemProps, int forkCount) throws SurefireBooterForkException - Throws:
SurefireBooterForkException
-
notifyStreamsToSkipTests
private static void notifyStreamsToSkipTests(Collection<? extends NotifiableTestStream> notifiableTestStreams) -
runSuitesForkPerTestSet
private RunResult runSuitesForkPerTestSet(SurefireProperties effectiveSystemProps, int forkCount) throws SurefireBooterForkException - Throws:
SurefireBooterForkException
-
awaitResultsDone
private static RunResult awaitResultsDone(Collection<Future<RunResult>> results, ExecutorService executorService) throws SurefireBooterForkException - Throws:
SurefireBooterForkException
-
closeExecutor
- Throws:
SurefireBooterForkException
-
fork
private RunResult fork(Object testSet, PropertiesWrapper providerProperties, ForkClient forkClient, SurefireProperties effectiveSystemProperties, int forkNumber, AbstractCommandReader commandReader, ForkNodeFactory forkNodeFactory, boolean readTestsFromInStream) throws SurefireBooterForkException - Throws:
SurefireBooterForkException
-
bindErrorStream
private static Stoppable bindErrorStream(int forkNumber, CountdownCloseable countdownCloseable, CommandlineStreams streams, Object errorStreamLock) -
getSuitesIterator
- Throws:
SurefireBooterForkException
-
createImmediateShutdownHookThread
private static Thread createImmediateShutdownHookThread(TestLessInputStream.TestLessInputStreamBuilder builder, Shutdown shutdownType) -
createCachableShutdownHookThread
private static Thread createCachableShutdownHookThread(TestLessInputStream.TestLessInputStreamBuilder builder, Shutdown shutdownType) -
createShutdownHookThread
private static Thread createShutdownHookThread(Iterable<TestProvidingInputStream> streams, Shutdown shutdownType) -
createPingScheduler
-
createTimeoutCheckScheduler
-
triggerPingTimerForShutdown
private ScheduledFuture<?> triggerPingTimerForShutdown(TestLessInputStream.TestLessInputStreamBuilder builder) -
triggerPingTimerForShutdown
-
triggerTimeoutCheck
-