Top Description Methods
org.junit.platform.engine.support.hierarchical

public Interface ResourceLock

extends AutoCloseable
Known Direct Implementers
org.junit.platform.engine.support.hierarchical.SingleLock, org.junit.platform.engine.support.hierarchical.CompositeLock, org.junit.platform.engine.support.hierarchical.NopLock
Annotations
@API
status:STABLE
since:1.10
Static Imports
org.apiguardian.api.API.Status.STABLE

A lock for a one or more resources.
Since
1.3
See Also
HierarchicalTestExecutorService.TestTask#getResourceLock()

Method Summary

Modifier and TypeMethod and Description
public ResourceLock

Returns:

this lock so it can easily be used in a try-with-resources statement.
acquire
()

Acquire this resource lock, potentially blocking.

public default void
close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

public List<ExclusiveResource>

Returns:

the exclusive resources this lock represents
getResources
()

Returns the exclusive resources this lock represents.

public default boolean

Returns:

whether the given lock is compatible with this lock
isCompatible
(ResourceLock
the other lock to check for compatibility
other
)

Returns whether the given lock is compatible with this lock.

public boolean

Returns:

whether this lock requires exclusiveness
isExclusive
()

Returns whether this lock requires exclusiveness.

public void
release()

Release this resource lock.

Method Detail

acquireback to summary
public ResourceLock acquire() throws InterruptedException

Acquire this resource lock, potentially blocking.

Returns:ResourceLock

this lock so it can easily be used in a try-with-resources statement.

Exceptions
InterruptedException:
if the calling thread is interrupted while waiting to acquire this lock
closeback to summary
public default void close()

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
getResourcesback to summary
public List<ExclusiveResource> getResources()

Returns the exclusive resources this lock represents.

Returns:List<ExclusiveResource>

the exclusive resources this lock represents

isCompatibleback to summary
public default boolean isCompatible(ResourceLock other)

Returns whether the given lock is compatible with this lock.

Parameters
other:ResourceLock

the other lock to check for compatibility

Returns:boolean

whether the given lock is compatible with this lock

isExclusiveback to summary
public boolean isExclusive()

Returns whether this lock requires exclusiveness.

Returns:boolean

whether this lock requires exclusiveness

releaseback to summary
public void release()

Release this resource lock.