/** * Execute the supplied {@link Callable} under a lock determined by the * descriptor. * * @param <R> the result type * @param callable the operation to perform under lock * @return whatever the supplied {@link Callable} returns * @throws Exception if the supplied {@link Callable} throws an exception */ <R> R withLock(final @NotNull Callable<R> callable) throws Exception;
/** * Execute the supplied {@link Runnable} under a lock determined by the * descriptor. * * @param runnable the operation to perform under lock */ void withLock(final @NotNull Runnable runnable);
/** * A {@link Supplier} of {@link ReentrantReadWriteLock read write locks}. * * @return lock factory */ static @NotNull com.atlassian.util.concurrent.Supplier<ReadWriteLock> readWriteLockFactory() { return new com.atlassian.util.concurrent.Supplier<ReadWriteLock>() { public ReadWriteLock get() { return new ReentrantReadWriteLock(); } }; }
/** * Execute the supplied {@link Supplier} under a lock determined by the * descriptor. * <p> * Unlike {@link #withLock(Callable)} this version returns a result and does * not declare a checked exception. * * @param <R> the result type * @param supplier the operation to perform under lock * @return whatever the supplied {@link Callable} returns */ <R> R withLock(final @NotNull Supplier<R> supplier);
private Predicate<SubscribedGadgetFeed> isJiraGadgetFeed(@NotNull final URI jiraGadgetFeed) { return new Predicate<SubscribedGadgetFeed>() { @Override public boolean apply(@Nullable SubscribedGadgetFeed input) { return jiraGadgetFeed.equals(input.getUri()); } }; }
private LongRunningTaskId(@NotNull String uuid) { this.uuid = uuid; }
/** * A {@link Supplier} of {@link ReentrantLock locks}. * * @return lock factory */ static @NotNull com.atlassian.util.concurrent.Supplier<Lock> lockFactory() { return new com.atlassian.util.concurrent.Supplier<Lock>() { public Lock get() { return new ReentrantLock(); } }; }
/** * Get a {@link ManagedLock.ReadWrite} that manages the supplied * {@link ReadWriteLock}. * * @param lock the lock to use. * @return a managed read write lock */ public static @NotNull ManagedLock.ReadWrite manageReadWrite(final @NotNull ReadWriteLock lock) { return new ReadWriteManagedLock(lock); }
/** * Get a {@link ManagedLock} that manages a {@link ReentrantLock}. * * @return a managed lock */ public static @NotNull ManagedLock newManagedLock() { return manage(new ReentrantLock()); }
/** * Creates a new SRSW BlockingReference. * * @deprecated use {@link #newSRSW()} instead. */ @Deprecated public BlockingReference(@NotNull final V value) { this(new BooleanLatch(), value); }
/** * Construct a new {@link WeakMemoizer} instance. * * @param initialCapacity how large the internal map should be initially. * @param delegate for creating the initial values. * @throws IllegalArgumentException if the initial capacity of elements is * negative. */ WeakMemoizer(final @NotNull Function<K, V> delegate) { this.map = new ConcurrentHashMap<K, MappedReference<K, V>>(); this.delegate = notNull("delegate", delegate); }
/** * Create a Builder with the supplied Executor * * @param executor */ public Builder(@NotNull final Executor executor) { this.executor = notNull("executor", executor); }
/** * Get a function that uses the Supplier as a factory for all inputs. * * @param <D> the key type, ignored * @param <R> the result type * @param supplier called for all inputs * @return the function */ public static <D, R> Function<D, R> fromSupplier(final @NotNull Supplier<R> supplier) { return new FromSupplier<D, R>(supplier); }
@Override public Collection<ProjectConfiguration> load(@NotNull Long projectId) { ProjectConfigurationAO[] projectConfigurationAOs = getAO().find( ProjectConfigurationAO.class, ProjectConfigurationAO.COLUMN_PROJECT_ID + " = ?", projectId); return Arrays.<ProjectConfiguration>asList(projectConfigurationAOs); } }