Package com.atlassian.bamboo.core
Class ScopedExclusionServiceHelper
- java.lang.Object
-
- com.atlassian.bamboo.core.ScopedExclusionServiceHelper
-
public class ScopedExclusionServiceHelper extends Object
Provides helper methods that provide higher level of abstraction over object locked byScopedExclusionService
.
-
-
Method Summary
-
-
-
Method Detail
-
withLockedKeyIdentifiedEntity
public static <V,E extends Throwable> V withLockedKeyIdentifiedEntity(ScopedExclusionService exclusionService, Key key, ScopedExclusionService.ExclusiveFunction<Key,V,E> functor) throws E extends Throwable
- Throws:
E extends Throwable
-
withLockedIdIdentifiedEntity
public static <V,E extends Throwable> V withLockedIdIdentifiedEntity(ScopedExclusionService exclusionService, long id, ScopedExclusionService.ExclusiveFunction<Long,V,E> functor) throws E extends Throwable
- Throws:
E extends Throwable
-
withLockedJob
public static <V,E extends Throwable> V withLockedJob(ScopedExclusionService exclusionService, PlanKey planKey, ScopedExclusionService.ExclusiveFunction<PlanKey,V,E> functor) throws E extends Throwable
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,E> functor) throws E extends Throwable
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,RuntimeException> clearSession(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,RuntimeException> adapt(com.google.common.base.Function<S,V> function)
Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
-
adapt
public static <S,V> ScopedExclusionService.ExclusiveFunction<S,V,RuntimeException> adapt(com.google.common.base.Supplier<V> supplier)
Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
-
adapt
public static <S,V> ScopedExclusionService.ExclusiveFunction<S,V,RuntimeException> adapt(Supplier<V> supplier)
-
adapt
public static <S> ScopedExclusionService.ExclusiveFunction<S,Void,RuntimeException> adapt(Runnable runnable)
Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
-
adapt
public static <S> ScopedExclusionService.ExclusiveFunction<S,Void,Exception> adapt(Callable<S> callable)
Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
-
adapt
public static <S,V,E extends Exception> ScopedExclusionService.ExclusiveFunction<S,V,E> adapt(LimitedConcurrencyCaller.Callable<V,E> callable)
Adapts the supplied parameter toScopedExclusionService.ExclusiveFunction
-
-