Module org.junit.platform.engine
Class ExclusiveResource
- java.lang.Object
-
- org.junit.platform.engine.support.hierarchical.ExclusiveResource
-
@API(status=EXPERIMENTAL, since="1.3") public class ExclusiveResource extends Object
An exclusive resource identified by a key with a lock mode that is used to synchronize access to shared resources when executing nodes in parallel.- Since:
- 1.3
- See Also:
Node.getExecutionMode()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExclusiveResource.LockMode
LockMode
translates to the respectiveReadWriteLock
locks.
-
Field Summary
Fields Modifier and Type Field Description static String
GLOBAL_KEY
Key of the global resource lock that all direct children of the engine descriptor acquire in read mode by default.
-
Constructor Summary
Constructors Constructor Description ExclusiveResource(String key, ExclusiveResource.LockMode lockMode)
Create a newExclusiveResource
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getKey()
Get the key of this resource.ExclusiveResource.LockMode
getLockMode()
Get the lock mode of this resource.int
hashCode()
String
toString()
-
-
-
Field Detail
-
GLOBAL_KEY
@API(status=EXPERIMENTAL, since="1.7") public static final String GLOBAL_KEY
Key of the global resource lock that all direct children of the engine descriptor acquire in read mode by default.If any node requires an exclusive resource with the same key in read-write mode, the lock will be coarsened to be acquired by the node's ancestor that is a direct child of the engine descriptor and all of the ancestor's descendants will be forced to run in the same thread.
- Since:
- 1.7
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExclusiveResource
public ExclusiveResource(String key, ExclusiveResource.LockMode lockMode)
Create a newExclusiveResource
.- Parameters:
key
- the identifier of the resource; nevernull
or blanklockMode
- the lock mode to use to synchronize access to the resource; nevernull
-
-
Method Detail
-
getKey
public String getKey()
Get the key of this resource.
-
getLockMode
public ExclusiveResource.LockMode getLockMode()
Get the lock mode of this resource.
-
-