public interface RepositoryLock
repository
while an operation
is performed.
Separate instances of this interface are not related. Locking a repository
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 repository data, so that only one is running on a given repository 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 repository.
PullRequestLock
,
UncheckedOperation
Modifier and Type | Method and Description |
---|---|
<T,E extends Exception> |
withLock(int repositoryId,
Operation<T,E> operation)
Performs the provided
operation while holding a lock on the specified repository . |
<T,E extends Exception> |
withLock(Repository repository,
Operation<T,E> operation)
Performs the provided
operation while holding a lock on the specified repository . |
<T,E extends Exception> T withLock(int repositoryId, @Nonnull Operation<T,E> operation) throws E extends Exception
operation
while holding a lock on the specified repository
.
Note: Locking a repository by ID or by Repository
instance acquires the same underlying lock.
T
- the return type of the perform operationE
- the type of Throwable that can be thrown from perform.repositoryId
- the ID
of the repository to lockoperation
- the operation
to perform while holding the lockperforming
the operationE
- if the operation
failsE extends Exception
<T,E extends Exception> T withLock(@Nonnull Repository repository, @Nonnull Operation<T,E> operation) throws E extends Exception
operation
while holding a lock on the specified repository
.
Note: Locking a repository by ID or by Repository
instance acquires the same underlying lock.
T
- the return type of the perform operationE
- the type of Throwable that can be thrown from perform.repository
- the repository
to lockoperation
- the operation
to perform while holding the lockperforming
the operationE
- if the operation
failsE extends Exception
Copyright © 2022 Atlassian. All rights reserved.