com.atlassian.bamboo.core
Class ScopedExclusionServiceHelper

java.lang.Object
  extended by com.atlassian.bamboo.core.ScopedExclusionServiceHelper

public class ScopedExclusionServiceHelper
extends java.lang.Object

Provides helper methods that provide higher level of abstraction over object locked by $ScopedExclusionService.


Method Summary
static
<S> ScopedExclusionService.ExclusiveFunction<S,java.lang.Void,java.lang.Exception>
adapt(java.util.concurrent.Callable<S> callable)
          Adapts the supplied parameter to $ScopedExclusionService.ExclusiveFunction
static
<S,V> ScopedExclusionService.ExclusiveFunction<S,V,java.lang.RuntimeException>
adapt(com.google.common.base.Function<S,V> function)
          Adapts the supplied parameter to $ScopedExclusionService.ExclusiveFunction
static
<S> ScopedExclusionService.ExclusiveFunction<S,java.lang.Void,java.lang.RuntimeException>
adapt(java.lang.Runnable runnable)
          Adapts the supplied parameter to $ScopedExclusionService.ExclusiveFunction
static
<S,V> ScopedExclusionService.ExclusiveFunction<S,V,java.lang.RuntimeException>
adapt(com.google.common.base.Supplier<V> supplier)
          Adapts the supplied parameter to $ScopedExclusionService.ExclusiveFunction
static
<S,V> ScopedExclusionService.ExclusiveFunction<S,V,java.lang.RuntimeException>
adapt(com.atlassian.util.concurrent.Supplier<V> supplier)
          Adapts the supplied parameter to $ScopedExclusionService.ExclusiveFunction
static
<S,V> ScopedExclusionService.ExclusiveFunction<S,V,java.lang.RuntimeException>
clearSession(ScopedExclusionService.ExclusiveFunction<S,V,java.lang.RuntimeException> function)
          Delegates a call to the supplied function, first flushing and clearing the Hibernate session.
static
<V,E extends java.lang.Throwable>
V
withLockedChain(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 java.lang.Throwable>
V
withLockedIdIdentifiedEntity(ScopedExclusionService exclusionService, long id, ScopedExclusionService.ExclusiveFunction<java.lang.Long,V,E> functor)
           
static
<V,E extends java.lang.Throwable>
V
withLockedJob(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 java.lang.Throwable>
V
withLockedKeyIdentifiedEntity(ScopedExclusionService exclusionService, Key key, ScopedExclusionService.ExclusiveFunction<Key,V,E> functor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

withLockedKeyIdentifiedEntity

public static <V,E extends java.lang.Throwable> V withLockedKeyIdentifiedEntity(ScopedExclusionService exclusionService,
                                                                                Key key,
                                                                                ScopedExclusionService.ExclusiveFunction<Key,V,E> functor)
                                       throws E extends java.lang.Throwable
Throws:
E extends java.lang.Throwable

withLockedIdIdentifiedEntity

public static <V,E extends java.lang.Throwable> V withLockedIdIdentifiedEntity(ScopedExclusionService exclusionService,
                                                                               long id,
                                                                               ScopedExclusionService.ExclusiveFunction<java.lang.Long,V,E> functor)
                                      throws E extends java.lang.Throwable
Throws:
E extends java.lang.Throwable

withLockedJob

public static <V,E extends java.lang.Throwable> V withLockedJob(ScopedExclusionService exclusionService,
                                                                PlanKey planKey,
                                                                ScopedExclusionService.ExclusiveFunction<PlanKey,V,E> functor)
                       throws E extends java.lang.Throwable
Executes the function while holding an exclusive lock on planKey interpreted as job key.

Parameters:
exclusionService -
planKey -
functor -
Throws:
E extends java.lang.Throwable

withLockedChain

public static <V,E extends java.lang.Throwable> V withLockedChain(ScopedExclusionService exclusionService,
                                                                  PlanKey planKey,
                                                                  ScopedExclusionService.ExclusiveFunction<PlanKey,V,E> functor)
                         throws E extends java.lang.Throwable
Executes the function while holding an exclusive lock on planKey interpreted as chain key.

Parameters:
exclusionService -
planKey -
functor -
Throws:
E extends java.lang.Throwable

clearSession

public static <S,V> ScopedExclusionService.ExclusiveFunction<S,V,java.lang.RuntimeException> clearSession(ScopedExclusionService.ExclusiveFunction<S,V,java.lang.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,java.lang.RuntimeException> adapt(com.google.common.base.Function<S,V> function)
Adapts the supplied parameter to $ScopedExclusionService.ExclusiveFunction


adapt

public static <S,V> ScopedExclusionService.ExclusiveFunction<S,V,java.lang.RuntimeException> adapt(com.google.common.base.Supplier<V> supplier)
Adapts the supplied parameter to $ScopedExclusionService.ExclusiveFunction


adapt

public static <S,V> ScopedExclusionService.ExclusiveFunction<S,V,java.lang.RuntimeException> adapt(com.atlassian.util.concurrent.Supplier<V> supplier)
Adapts the supplied parameter to $ScopedExclusionService.ExclusiveFunction


adapt

public static <S> ScopedExclusionService.ExclusiveFunction<S,java.lang.Void,java.lang.RuntimeException> adapt(java.lang.Runnable runnable)
Adapts the supplied parameter to $ScopedExclusionService.ExclusiveFunction


adapt

public static <S> ScopedExclusionService.ExclusiveFunction<S,java.lang.Void,java.lang.Exception> adapt(java.util.concurrent.Callable<S> callable)
Adapts the supplied parameter to $ScopedExclusionService.ExclusiveFunction



Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.