com.atlassian.util.concurrent
Interface LockManager<T>

Type Parameters:
T - The input type that we lock on.
D - The stripe type that we stripe locks on.

public interface LockManager<T>

LockManager allows callables and runnables to be run under a lock that is resolved against an input object.


Method Summary
<R> R
withLock(T descriptor, java.util.concurrent.Callable<R> callable)
          Execute the supplied Callable under a lock determined by the descriptor.
 void withLock(T descriptor, java.lang.Runnable runnable)
          Execute the supplied Runnable under a lock determined by the descriptor.
 

Method Detail

withLock

<R> R withLock(T descriptor,
               java.util.concurrent.Callable<R> callable)
           throws java.lang.Exception
Execute the supplied Callable under a lock determined by the descriptor.

Type Parameters:
R - the result type
Parameters:
descriptor - to look up the lock
callable - the operation to perform under lock
Returns:
whatever the supplied Callable returns
Throws:
java.lang.Exception - if the supplied Callable throws an exception

withLock

void withLock(T descriptor,
              java.lang.Runnable runnable)
Execute the supplied Runnable under a lock determined by the descriptor.

Parameters:
descriptor - to look up the lock
runnable - the operation to perform under lock


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.