Class ExclusiveResource
- java.lang.Object
-
- org.junit.platform.engine.support.hierarchical.ExclusiveResource
-
@API(status=EXPERIMENTAL, since="1.3") public class ExclusiveResource extends java.lang.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 private int
hash
private java.lang.String
key
private ExclusiveResource.LockMode
lockMode
-
Constructor Summary
Constructors Constructor Description ExclusiveResource(java.lang.String key, ExclusiveResource.LockMode lockMode)
Create a newExclusiveResource
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.String
getKey()
Get the key of this resource.ExclusiveResource.LockMode
getLockMode()
Get the lock mode of this resource.int
hashCode()
java.lang.String
toString()
-
-
-
Field Detail
-
key
private final java.lang.String key
-
lockMode
private final ExclusiveResource.LockMode lockMode
-
hash
private int hash
-
-
Constructor Detail
-
ExclusiveResource
public ExclusiveResource(java.lang.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 java.lang.String getKey()
Get the key of this resource.
-
getLockMode
public ExclusiveResource.LockMode getLockMode()
Get the lock mode of this resource.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-