public interface ScopedExclusionService
com.atlassian.bamboo.core.ScopedExclusionServiceHelper class.
All taken locks are exclusive. A lock is always taken in a scope. For example a lock on PROJECT_DATA scope defined by
project name 'MINE-ALLMINE' would be different than a lock taken on JOB_KEY scope with name 'MINE-ALLMINE'.
You can use any object for locking, but since this service is shared, it's very important to lock the same
objects that other users of service lock within the same exclusion scope. That's why use of ExclusionScopeType or, better yet
com.atlassian.bamboo.core.ScopedExclusionServiceHelper is strongly recommended.| Modifier and Type | Interface and Description |
|---|---|
static class |
ScopedExclusionService.ExclusionScopeType
Predefined exclusion scopes.
|
static interface |
ScopedExclusionService.ExclusiveFunction<F,V,E extends Throwable>
Function to call once the object is locked.
|
static interface |
ScopedExclusionService.GeneratorCallable<V,E extends Throwable>
Generator called to generate new names for objects.
|
| Modifier and Type | Method and Description |
|---|---|
<S,V,E extends Throwable> |
withLock(Enum<?> scopeType,
S objectToLock,
ScopedExclusionService.ExclusiveFunction<S,V,E> function)
Executes function with lock taken in a given scope and object name.
|
<S,V,E extends Throwable,F extends Throwable> |
withNewLockedObject(Enum<?> generationScope,
S objectToLockDuringGeneration,
Enum<?> generatedObjectScope,
ScopedExclusionService.GeneratorCallable<S,F> objectGenerator,
ScopedExclusionService.ExclusiveFunction<S,V,E> function)
Executes code with a new, unique name generated within given exclusion scope and locked for exclusive use.
|
<S,V,E extends Throwable> V withLock(@NotNull Enum<?> scopeType, @NotNull S objectToLock, @NotNull ScopedExclusionService.ExclusiveFunction<S,V,E> function) throws E extends Throwable
scopeType - type of scope (if we wanted to lock a Job, this would be JOB_KEY - jobs are locked by key)objectToLock - object to lock within scope (if we wanted to lock a Job, this would be job key)function - the function to callE - exception thrown from functionE extends Throwable<S,V,E extends Throwable,F extends Throwable> V withNewLockedObject(@NotNull Enum<?> generationScope, @Nullable S objectToLockDuringGeneration, @Nullable Enum<?> generatedObjectScope, @NotNull ScopedExclusionService.GeneratorCallable<S,F> objectGenerator, @NotNull ScopedExclusionService.ExclusiveFunction<S,V,E> function) throws E extends Throwable, F extends Throwable
E extends ThrowableCopyright © 2016 Atlassian Software Systems Pty Ltd. All rights reserved.