Interface Forker

  • All Known Implementing Classes:
    DefaultForker

    public interface Forker
    A forker is an implementation of an execution forking mechanism. Its task is to create another process, which ideally is an exact clone of the current (parent) process. The idea is similar to a UNIX fork, but the child process is expected to start "fresh" instead of continuing at the current instruction.

    The implementations of this interface are usually instantiated once per created fork via their default constructor. If you'd like to have a parameterizable forker, you may add a constructor that accepts parameters. Use the ForkerParameter annotation to annotate parameters in the constructor and provide names for them, very much like you do with Fixture method and FixtureParameter.

    Author:
    Rene Schneider - initial API and implementation
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String SYSPARAM_FORK_NAME
      System parameter name for the fork name.
      static java.lang.String SYSPARAM_FORK_REMOTING_HOST
      System parameter name for the host interface that the remoting should bind to on the fork.
      static java.lang.String SYSPARAM_FORK_REMOTING_PORT
      System parameter name for the remoting port to use to communicate with the fork.
      static java.lang.String SYSPARAM_FORK_SEED
      System parameter for the forks' RNG seed.
      static java.lang.String SYSPARAM_FORK_TIMESTATE
      System parameter for the forks' test time generator state.
    • Field Detail

      • SYSPARAM_FORK_REMOTING_HOST

        static final java.lang.String SYSPARAM_FORK_REMOTING_HOST
        System parameter name for the host interface that the remoting should bind to on the fork. If this is set, it overrides the setting that is provided to the test runner for general remoting.
        See Also:
        Constant Field Values
      • SYSPARAM_FORK_REMOTING_PORT

        static final java.lang.String SYSPARAM_FORK_REMOTING_PORT
        System parameter name for the remoting port to use to communicate with the fork. If this is set, it overrides the setting that is provided to the test runner for general remoting.
        See Also:
        Constant Field Values
      • SYSPARAM_FORK_NAME

        static final java.lang.String SYSPARAM_FORK_NAME
        System parameter name for the fork name.
        See Also:
        Constant Field Values
      • SYSPARAM_FORK_SEED

        static final java.lang.String SYSPARAM_FORK_SEED
        System parameter for the forks' RNG seed.
        See Also:
        Constant Field Values
      • SYSPARAM_FORK_TIMESTATE

        static final java.lang.String SYSPARAM_FORK_TIMESTATE
        System parameter for the forks' test time generator state.
        See Also:
        Constant Field Values
    • Method Detail

      • fork

        ForkedProcess fork​(java.lang.String[] someCommandLineArguments,
                           java.lang.String aForkName,
                           long aRandomSeed,
                           TimeSyncState aTimeSyncState)
                    throws ForkException
        Performs the actual forking.
        Parameters:
        someCommandLineArguments - the original command line arguments given to the JVM of the parent process
        aForkName - the name of the fork
        aRandomSeed - the seed for the RNG of the fork
        aTimeSyncState - time synchronization state info for this particular fork (will be provided just in case the forker wants to do something with it - time synchronization also happens right after the connection to the fork was established by the master) or null if no test time sync state is to be set
        Returns:
        the newly created process
        Throws:
        ForkException - if something goes wrong