Interface PullRequestLock
pull request
while an operation
is
performed.
Separate instances of this interface are not related. Locking a pull request
in one
instance does not lock it in any other. The intention is to allow grouping operations
that
perform similar processing, or rely on the same pull request data, so that only one is running on a given pull
request at a time, using multiple locks when different bands of processing can be performed concurrently.
Note: When used by plugin developers, no instance of this lock can ever prevent the host application from performing any of its own processing on any aspect of a pull request.
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<T,
E extends Exception>
TPerforms the providedoperation
while holding a lock on the specifiedpull request
.<T,
E extends Exception>
TwithLock
(PullRequest pullRequest, Operation<T, E> operation) Performs the providedoperation
while holding a lock on the specifiedpull request
.
-
Method Details
-
withLock
<T,E extends Exception> T withLock(int repositoryId, long pullRequestId, @Nonnull Operation<T, E> operation) throws EPerforms the providedoperation
while holding a lock on the specifiedpull request
.Note: Locking a pull request by ID or by
PullRequest
instance acquires the same underlying lock.- Type Parameters:
T
- the return type of the perform operationE
- the type of Throwable that can be thrown from perform.- Parameters:
repositoryId
- theID
of the repository to lockpullRequestId
- theID
of the pull request to lock in the specified repositoryoperation
- theoperation
to perform while holding the lock- Returns:
- the result of
performing
the operation - Throws:
E
- if theoperation
fails
-
withLock
<T,E extends Exception> T withLock(@Nonnull PullRequest pullRequest, @Nonnull Operation<T, E> operation) throws EPerforms the providedoperation
while holding a lock on the specifiedpull request
.Note: Locking a pull request by ID or by
PullRequest
instance acquires the same underlying lock.- Type Parameters:
T
- the return type of the perform operationE
- the type of Throwable that can be thrown from perform.- Parameters:
pullRequest
- thepull request
to lockoperation
- theoperation
to perform while holding the lock- Returns:
- the result of
performing
the operation - Throws:
E
- if theoperation
fails
-