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(@NotNull Enum<?> scopeType,
S objectToLock,
@NotNull 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(@NotNull Enum<?> scopeType,
S objectToLock,
@NotNull 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(@NotNull Enum<?> generationScope,
S objectToLockDuringGeneration,
@Nullable Enum<?> generatedObjectScope,
@NotNull ScopedExclusionService.GeneratorCallable<S,F> objectGenerator,
@NotNull 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 @NotNull Enum<?> scopeType, @NotNull S objectToLock, @NotNull @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 @NotNull Enum<?> scopeType, @NotNull S objectToLock, @NotNull @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 @NotNull Enum<?> generationScope, @Nullable S objectToLockDuringGeneration, @Nullable @Nullable Enum<?> generatedObjectScope, @NotNull @NotNull ScopedExclusionService.GeneratorCallable<S,F> objectGenerator, @NotNull @NotNull ScopedExclusionService.ExclusiveFunction<S,V,E> function) throws E extends Throwable, F extends Throwable
E extends Throwable
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.