Package com.github.phantomthief.util
Class MoreLocks
- java.lang.Object
-
- com.github.phantomthief.util.MoreLocks
-
public final class MoreLocks extends Object
- Author:
- w.vela
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <X extends Throwable>
voidrunWithLock(Lock lock, ThrowableRunnable<X> runnable)static <X extends Throwable>
voidrunWithTryLock(Lock lock, long time, TimeUnit unit, ThrowableRunnable<X> runnable)static <X extends Throwable>
voidrunWithTryLock(Lock lock, long time, TimeUnit unit, ThrowableRunnable<X> runnable, Runnable withoutAcquiredLock)static <X extends Throwable>
voidrunWithTryLock(Lock lock, ThrowableRunnable<X> runnable)static <X extends Throwable>
voidrunWithTryLock(Lock lock, ThrowableRunnable<X> runnable, Runnable withoutAcquiredLock)static <T,X extends Throwable>
TsupplyWithLock(Lock lock, ThrowableSupplier<T,X> supplier)static <T,X extends Throwable>
TsupplyWithTryLock(Lock lock, long time, TimeUnit unit, ThrowableSupplier<T,X> supplier)static <T,X extends Throwable>
TsupplyWithTryLock(Lock lock, long time, TimeUnit unit, ThrowableSupplier<T,X> supplier, Supplier<T> withoutAcquiredLock)static <T,X extends Throwable>
TsupplyWithTryLock(Lock lock, ThrowableSupplier<T,X> supplier)static <T,X extends Throwable>
TsupplyWithTryLock(Lock lock, ThrowableSupplier<T,X> supplier, Supplier<T> withoutAcquiredLock)
-
-
-
Method Detail
-
runWithLock
public static <X extends Throwable> void runWithLock(Lock lock, ThrowableRunnable<X> runnable) throws X extends Throwable
- Throws:
X extends Throwable
-
supplyWithLock
public static <T,X extends Throwable> T supplyWithLock(Lock lock, ThrowableSupplier<T,X> supplier) throws X extends Throwable
- Throws:
X extends Throwable
-
runWithTryLock
public static <X extends Throwable> void runWithTryLock(Lock lock, long time, TimeUnit unit, ThrowableRunnable<X> runnable) throws X extends Throwable, InterruptedException
- Throws:
X extends ThrowableInterruptedException
-
runWithTryLock
public static <X extends Throwable> void runWithTryLock(Lock lock, long time, TimeUnit unit, ThrowableRunnable<X> runnable, Runnable withoutAcquiredLock) throws X extends Throwable, InterruptedException
- Throws:
X extends ThrowableInterruptedException
-
supplyWithTryLock
public static <T,X extends Throwable> T supplyWithTryLock(Lock lock, long time, TimeUnit unit, ThrowableSupplier<T,X> supplier) throws X extends Throwable, InterruptedException
- Throws:
X extends ThrowableInterruptedException
-
supplyWithTryLock
public static <T,X extends Throwable> T supplyWithTryLock(Lock lock, long time, TimeUnit unit, ThrowableSupplier<T,X> supplier, Supplier<T> withoutAcquiredLock) throws X extends Throwable, InterruptedException
- Throws:
X extends ThrowableInterruptedException
-
runWithTryLock
public static <X extends Throwable> void runWithTryLock(Lock lock, ThrowableRunnable<X> runnable) throws X extends Throwable
- Throws:
X extends Throwable
-
runWithTryLock
public static <X extends Throwable> void runWithTryLock(Lock lock, ThrowableRunnable<X> runnable, Runnable withoutAcquiredLock) throws X extends Throwable
- Throws:
X extends Throwable
-
supplyWithTryLock
public static <T,X extends Throwable> T supplyWithTryLock(Lock lock, ThrowableSupplier<T,X> supplier) throws X extends Throwable
- Throws:
X extends Throwable
-
-