Annotation Type State


  • @Inherited
    @Target(TYPE)
    @Retention(RUNTIME)
    public @interface State

    Marks the state object.

    State objects naturally encapsulate the state on which benchmark is working on. The Scope of state object defines to which extent it is shared among the worker threads.

    State objects are usually injected into Benchmark methods as arguments, and JMH takes care of their instantiation and sharing. State objects may also be injected into Setup and TearDown methods of other State objects to get the staged initialization. In that case, the dependency graph between the State-s should be directed acyclic graph.

    State objects may be inherited: you can place State on a super class and use subclasses as states.

    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      Scope value
      State scope.
    • Element Detail

      • value

        Scope value
        State scope.
        Returns:
        state scope
        See Also:
        Scope