Interface ForkedProcessTimeoutContext


  • public interface ForkedProcessTimeoutContext
    Information about a forked Surefire test JVM that has reached its configured timeout, passed to ForkedProcessTimeoutExtension callbacks.
    Since:
    3.6.0
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      org.apache.maven.plugin.surefire.log.api.ConsoleLogger getConsoleLogger()
      Logger that extensions should use for diagnostic output to the Maven console.
      default java.util.Map<java.lang.String,​java.lang.String> getExtensionContext()
      User-supplied extension configuration, as provided by the forkedProcessTimeoutExtensionContext Mojo parameter.
      int getForkNumber()
      The fork channel id (1-based) assigned by Surefire to this forked JVM.
      java.io.File getJavaExecutable()
      The java executable used to launch the forked JVM, or null when it cannot be determined.
      long getPid()
      The operating-system PID of the forked JVM, or -1 when the PID cannot be determined (for instance on Java 8 where the ProcessHandle API is unavailable).
      java.io.File getReportsDirectory()
      The Surefire reports directory configured for the current run.
      int getTimeoutSeconds()
      The configured forkedProcessTimeoutInSeconds.
    • Method Detail

      • getPid

        long getPid()
        The operating-system PID of the forked JVM, or -1 when the PID cannot be determined (for instance on Java 8 where the ProcessHandle API is unavailable).
        Returns:
        the forked process PID, or -1 if unknown
      • getForkNumber

        int getForkNumber()
        The fork channel id (1-based) assigned by Surefire to this forked JVM.
        Returns:
        the fork number
      • getJavaExecutable

        java.io.File getJavaExecutable()
        The java executable used to launch the forked JVM, or null when it cannot be determined.
        Returns:
        the java executable used by the fork, or null
      • getReportsDirectory

        java.io.File getReportsDirectory()
        The Surefire reports directory configured for the current run. Extensions may use this directory to write diagnostic output (thread dumps, etc.).
        Returns:
        the reports directory; never null
      • getTimeoutSeconds

        int getTimeoutSeconds()
        The configured forkedProcessTimeoutInSeconds.
        Returns:
        the configured timeout in seconds (always greater than 0)
      • getConsoleLogger

        org.apache.maven.plugin.surefire.log.api.ConsoleLogger getConsoleLogger()
        Logger that extensions should use for diagnostic output to the Maven console.
        Returns:
        the console logger; never null
      • getExtensionContext

        default java.util.Map<java.lang.String,​java.lang.String> getExtensionContext()
        User-supplied extension configuration, as provided by the forkedProcessTimeoutExtensionContext Mojo parameter. Extensions may read implementation-specific keys from this map (for instance the built-in jstack extension reads jstack.output.location).

        The map is never null but may be empty. Implementations should treat it as read-only.

        Returns:
        user-supplied extension configuration; never null