com.atlassian.util.concurrent
Class LockManagers

java.lang.Object
  extended by com.atlassian.util.concurrent.LockManagers

Deprecated. since 0.0.7 use ManagedLocks instead

@Deprecated
public class LockManagers
extends java.lang.Object


Constructor Summary
LockManagers()
          Deprecated.  
 
Method Summary
static
<T> LockManager<T>
weakLockManager()
          Deprecated. use ManagedLocks.weakManagedLockFactory() instead.
static
<T,D> LockManager<T>
weakLockManager(Function<T,D> stripeFunction)
          Deprecated. use ManagedLocks.weakManagedLockFactory(Function) instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LockManagers

public LockManagers()
Deprecated. 
Method Detail

weakLockManager

@Deprecated
public static <T> LockManager<T> weakLockManager()
Deprecated. use ManagedLocks.weakManagedLockFactory() instead.

Convenience method that simply calls weakLockManager(Function) with the identity function. So all inputs map directly to an individual lock.

Type Parameters:
T - the type of the thing used to look up locks

weakLockManager

@Deprecated
public static <T,D> LockManager<T> weakLockManager(Function<T,D> stripeFunction)
Deprecated. use ManagedLocks.weakManagedLockFactory(Function) instead.

Get a LockManager that is used to perform operations under a particular lock. The specific lock chosen is decided by the supplied striping function. The particular Lock is resolved using a Function that resolves to a descriptor used to look up a Lock instance. This allows for a finite set of locks to be used even if the set of T is essentially unbounded.

For instance:

 LockManager<Identifiable, Integer> manager = LockManagers.weakLockManager(new Function<Identifiable, Integer>() {
     Integer get(Identifiable thing) {
         return thing.getId() % 16;
     }
 };
 
uses only 16 possible locks as the function returns the modulo 16 of the thing's id.

Type Parameters:
T - the type of the thing used to look up locks
D - the type used to map lock instances
Parameters:
stripeFunction - to convert Ts to Ds.
Returns:
a new LockManager instance that stores created Lock instances with weak references.


Copyright © 2011 Atlassian. All Rights Reserved.