public interface ScopedExclusionService
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> |
tryWithLock(Enum<?> scopeType,
S objectToLock,
ScopedExclusionService.ExclusiveFunction<S,V,E> function)
Executes function with lock taken in a given scope and object name or returns immediately if lock is already taken.
|
<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> io.atlassian.fugue.Either<Boolean,Optional<V>> tryWithLock(@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 Throwable
Copyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.