/** * A convenience method for calling * {@link #weakReadWriteManagedLockFactory(Function)} that uses the * {@link Functions#identity() identity function} for striping, essentially * meaning that unique input will have its own lock. * * @param <T> the type of the thing used to look up locks * @return a new {@link Function} that provides the appropriate * {@link ReadWrite} for the argument {@link ManagedLock.ReadWrite} instances * that stores created instances with weak references. */ public static @NotNull <T> com.atlassian.util.concurrent.Function<T, ManagedLock.ReadWrite> weakReadWriteManagedLockFactory() { return weakReadWriteManagedLockFactory(Functions.<T> identity()); }
/** * A convenience method for calling * {@link #weakReadWriteManagedLockFactory(Function, Supplier)} that uses * default {@link ReentrantReadWriteLock locks} * * @param <T> the type of the thing used to look up locks * @param <D> the type used to map lock instances, should be a good map key * @param stripeFunction * @return a new {@link Function} that provides {@link ManagedLock.ReadWrite} * instances that stores created instances with weak references. */ public static @NotNull <T, D> com.atlassian.util.concurrent.Function<T, ManagedLock.ReadWrite> weakReadWriteManagedLockFactory( final Function<T, D> stripeFunction) { return weakReadWriteManagedLockFactory(stripeFunction, readWriteLockFactory()); }