Class ForkClient

  • All Implemented Interfaces:
    org.apache.maven.shared.utils.cli.StreamConsumer

    public class ForkClient
    extends java.lang.Object
    implements org.apache.maven.shared.utils.cli.StreamConsumer
    Knows how to reconstruct *all* the state transmitted over stdout by the forked process.
    • Field Detail

      • PRINTABLE_JVM_NATIVE_STREAM

        private static final java.lang.String PRINTABLE_JVM_NATIVE_STREAM
        See Also:
        Constant Field Values
      • START_TIME_NEGATIVE_TIMEOUT

        private static final long START_TIME_NEGATIVE_TIMEOUT
        See Also:
        Constant Field Values
      • testVmSystemProperties

        private final java.util.Map<java.lang.String,​java.lang.String> testVmSystemProperties
      • testsInProgress

        private final java.util.Queue<java.lang.String> testsInProgress
      • printedErrorStream

        private final java.util.concurrent.atomic.AtomicBoolean printedErrorStream
        prevents from printing same warning
      • forkNumber

        private final int forkNumber
      • saidGoodBye

        private volatile boolean saidGoodBye
        Written by one Thread and read by another: Main Thread and ForkStarter's Thread.
    • Method Detail

      • stopOnNextTest

        protected void stopOnNextTest()
        Overridden by a subclass, see ForkStarter.
      • kill

        public void kill()
      • tryToTimeout

        public final void tryToTimeout​(long currentTimeMillis,
                                       int forkedProcessTimeoutInSeconds)
        Called in concurrent Thread. Will shutdown if timeout was reached.
        Parameters:
        currentTimeMillis - current time in millis seconds
        forkedProcessTimeoutInSeconds - timeout in seconds given by MOJO
      • consumeLine

        public final void consumeLine​(java.lang.String s)
        Specified by:
        consumeLine in interface org.apache.maven.shared.utils.cli.StreamConsumer
      • setCurrentStartTime

        private void setCurrentStartTime()
      • hadTimeout

        public final boolean hadTimeout()
      • getTestSetReporter

        private RunListener getTestSetReporter()
      • processLine

        private void processLine​(java.lang.String event)
      • dumpToLoFile

        private java.io.File dumpToLoFile​(java.lang.String msg,
                                          java.lang.Throwable e)
      • logStreamWarning

        private void logStreamWarning​(java.lang.String event,
                                      java.lang.Throwable e)
      • writeTestOutput

        private void writeTestOutput​(java.lang.String output,
                                     boolean newLine,
                                     boolean isStdout)
      • consumeMultiLineContent

        public final void consumeMultiLineContent​(java.lang.String s)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • getTestVmSystemProperties

        public final java.util.Map<java.lang.String,​java.lang.String> getTestVmSystemProperties()
      • getReporter

        public final RunListener getReporter()
        Used when getting reporters on the plugin side of a fork. Used by testing purposes only. May not be volatile variable.
        Returns:
        A mock provider reporter
      • getOrCreateConsoleLogger

        private ConsoleLogger getOrCreateConsoleLogger()
      • close

        public void close​(boolean hadTimeout)
      • isSaidGoodBye

        public final boolean isSaidGoodBye()
      • isErrorInFork

        public final boolean isErrorInFork()
      • testsInProgress

        public java.util.Set<java.lang.String> testsInProgress()
      • hasTestsInProgress

        public boolean hasTestsInProgress()
      • deserializeStackTraceWriter

        private StackTraceWriter deserializeStackTraceWriter​(java.lang.String stackTraceMessage,
                                                             java.lang.String smartStackTrace,
                                                             java.lang.String stackTrace)