Package spock.lang

Annotation Type ResourceLock


@Beta
@Retention(RUNTIME)
@Target({TYPE,METHOD})
@Repeatable(Container.class)
public @interface ResourceLock
Allows to control access to a shared resource. If applied on class-level, the lock will be on the class, covering shared fields and setupSpec/cleanupSpec. This will also cause all features to run on the same thread as the Specification.
Since:
2.0
See Also:
Isolated, Execution
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static interface  ResourceLock.Container  
  • Required Element Summary

    Required Elements
    Modifier and Type Required Element Description
    String value
    The key identifying the resource.
  • Optional Element Summary

    Optional Elements
    Modifier and Type Optional Element Description
    org.spockframework.runtime.model.parallel.ResourceAccessMode mode
    Controls the access mode of the resource.
  • Element Details

    • value

      String value
      The key identifying the resource.
      Returns:
      the key
      See Also:
      for a list of standard resources
    • mode

      org.spockframework.runtime.model.parallel.ResourceAccessMode mode
      Controls the access mode of the resource.
      Returns:
      mode to use
      Default:
      READ_WRITE