Package com.atlassian.bamboo.core
Class ScopedExclusionServiceHelper
java.lang.Object
com.atlassian.bamboo.core.ScopedExclusionServiceHelper
Provides helper methods that provide higher level of abstraction over object locked by
ScopedExclusionService
.-
Method Summary
Modifier and TypeMethodDescriptionstatic <S,
V, E extends Exception>
ScopedExclusionService.ExclusiveFunction<S,V, E> adapt
(LimitedConcurrencyCaller.Callable<V, E> callable) Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
static <S,
V> ScopedExclusionService.ExclusiveFunction<S, V, RuntimeException> adapt
(com.google.common.base.Supplier<V> supplier) Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
static <S> ScopedExclusionService.ExclusiveFunction<S,
Void, RuntimeException> Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
static <S> ScopedExclusionService.ExclusiveFunction<S,
Void, Exception> Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
static <S,
V> ScopedExclusionService.ExclusiveFunction<S, V, RuntimeException> Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
static <S,
V> ScopedExclusionService.ExclusiveFunction<S, V, RuntimeException> static <S,
V> ScopedExclusionService.ExclusiveFunction<S, V, RuntimeException> clearSession
(ScopedExclusionService.ExclusiveFunction<S, V, RuntimeException> function) Delegates a call to the supplied function, first flushing and clearing the Hibernate session.static <V,
E extends Throwable>
VwithLockedChain
(ScopedExclusionService exclusionService, PlanKey planKey, ScopedExclusionService.ExclusiveFunction<PlanKey, V, E> functor) Executes the function while holding an exclusive lock on planKey interpreted as chain key.static <V,
E extends Throwable>
VwithLockedIdIdentifiedEntity
(ScopedExclusionService exclusionService, long id, ScopedExclusionService.ExclusiveFunction<Long, V, E> functor) static <V,
E extends Throwable>
VwithLockedJob
(ScopedExclusionService exclusionService, PlanKey planKey, ScopedExclusionService.ExclusiveFunction<PlanKey, V, E> functor) Executes the function while holding an exclusive lock on planKey interpreted as job key.static <V,
E extends Throwable>
VwithLockedKeyIdentifiedEntity
(ScopedExclusionService exclusionService, Key key, ScopedExclusionService.ExclusiveFunction<Key, V, E> functor)
-
Method Details
-
withLockedKeyIdentifiedEntity
public static <V,E extends Throwable> V withLockedKeyIdentifiedEntity(ScopedExclusionService exclusionService, Key key, ScopedExclusionService.ExclusiveFunction<Key, V, throws EE> functor) - Throws:
E extends Throwable
-
withLockedIdIdentifiedEntity
public static <V,E extends Throwable> V withLockedIdIdentifiedEntity(ScopedExclusionService exclusionService, long id, ScopedExclusionService.ExclusiveFunction<Long, V, throws EE> functor) - Throws:
E extends Throwable
-
withLockedJob
public static <V,E extends Throwable> V withLockedJob(ScopedExclusionService exclusionService, PlanKey planKey, ScopedExclusionService.ExclusiveFunction<PlanKey, V, throws EE> functor) Executes the function while holding an exclusive lock on planKey interpreted as job key.- Parameters:
exclusionService
-planKey
-functor
-- Throws:
E extends Throwable
-
withLockedChain
public static <V,E extends Throwable> V withLockedChain(ScopedExclusionService exclusionService, PlanKey planKey, ScopedExclusionService.ExclusiveFunction<PlanKey, V, throws EE> functor) Executes the function while holding an exclusive lock on planKey interpreted as chain key.- Parameters:
exclusionService
-planKey
-functor
-- Throws:
E extends Throwable
-
clearSession
public static <S,V> ScopedExclusionService.ExclusiveFunction<S,V, clearSessionRuntimeException> (ScopedExclusionService.ExclusiveFunction<S, V, RuntimeException> function) Delegates a call to the supplied function, first flushing and clearing the Hibernate session. -
adapt
public static <S,V> ScopedExclusionService.ExclusiveFunction<S,V, adaptRuntimeException> (Function<S, V> function) Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
-
adapt
public static <S,V> ScopedExclusionService.ExclusiveFunction<S,V, adaptRuntimeException> (com.google.common.base.Supplier<V> supplier) Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
-
adapt
public static <S,V> ScopedExclusionService.ExclusiveFunction<S,V, adaptRuntimeException> (Supplier<V> supplier) -
adapt
public static <S> ScopedExclusionService.ExclusiveFunction<S,Void, adaptRuntimeException> (Runnable runnable) Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
-
adapt
public static <S> ScopedExclusionService.ExclusiveFunction<S,Void, adaptException> (Callable<S> callable) Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
-
adapt
public static <S,V, ScopedExclusionService.ExclusiveFunction<S,E extends Exception> V, adaptE> (LimitedConcurrencyCaller.Callable<V, E> callable) Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
-