public class ScopedExclusionServiceImpl extends Object implements ScopedExclusionService
ScopedExclusionService.ExclusionScopeType, ScopedExclusionService.ExclusiveFunction<F,V,E extends Throwable>, ScopedExclusionService.GeneratorCallable<V,E extends Throwable>
Constructor and Description |
---|
ScopedExclusionServiceImpl() |
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.
|
static <T> com.google.common.cache.LoadingCache<T,ReadWriteLock> |
weakReadWriteLockFactory() |
<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<?> generationScopeType,
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.
|
public static <T> com.google.common.cache.LoadingCache<T,ReadWriteLock> weakReadWriteLockFactory()
public <S,V,E extends Throwable,F extends Throwable> V withNewLockedObject(@NotNull Enum<?> generationScopeType, @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
ScopedExclusionService
withNewLockedObject
in interface ScopedExclusionService
E extends Throwable
public <S,V,E extends Throwable> V withLock(@NotNull Enum<?> scopeType, @NotNull S objectToLock, @NotNull ScopedExclusionService.ExclusiveFunction<S,V,E> function) throws E extends Throwable
ScopedExclusionService
withLock
in interface ScopedExclusionService
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
public <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
ScopedExclusionService
tryWithLock
in interface ScopedExclusionService
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
Copyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.