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
FieldsModifier and TypeFieldDescriptionstatic final StringSystem parameter name for the fork name.static final StringSystem parameter name for the host interface that the remoting should bind to on the fork.static final StringSystem parameter name for the remoting port to use to communicate with the fork.static final StringSystem parameter for the forks' RNG seed.static final StringSystem parameter for the forks' test time generator state. -
Method Summary
Modifier and TypeMethodDescriptionfork(String[] someCommandLineArguments, String aForkName, long aRandomSeed, TimeSyncState aTimeSyncState) Performs the actual forking.
-
Field Details
-
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:
-
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:
-
SYSPARAM_FORK_NAME
System parameter name for the fork name.- See Also:
-
SYSPARAM_FORK_SEED
System parameter for the forks' RNG seed.- See Also:
-
SYSPARAM_FORK_TIMESTATE
System parameter for the forks' test time generator state.- See Also:
-
-
Method Details
-
fork
ForkedProcess fork(String[] someCommandLineArguments, 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 processaForkName- the name of the forkaRandomSeed- the seed for the RNG of the forkaTimeSyncState- 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
-