/** * Convenience method that calls * {@link ManagedLocks#weakManagedLockFactory(Function)} using 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 * @see #weakManagedLockFactory(Function, Supplier) */ public static @NotNull <T> com.atlassian.util.concurrent.Function<T, ManagedLock> weakManagedLockFactory() { return weakManagedLockFactory(Functions.<T> identity()); }
/** * Convenience method that simply calls * {@link #weakManagedLockFactory(Function, Supplier)} with the * {@link #lockFactory() default lock factory}. * * @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 to convert Ts to Ds. * @see #weakManagedLockFactory(Function, Supplier) */ public static @NotNull <T, D> com.atlassian.util.concurrent.Function<T, ManagedLock> weakManagedLockFactory( final @NotNull Function<T, D> stripeFunction) { return weakManagedLockFactory(stripeFunction, lockFactory()); }