Package org.openjdk.jmh.annotations
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 intoSetup
andTearDown
methods of otherState
objects to get the staged initialization. In that case, the dependency graph between theState
-s should be directed acyclic graph.State objects may be inherited: you can place
State
on a super class and use subclasses as states.