Fix compilation issue

This commit is contained in:
Andrea Cavalli 2021-08-22 18:19:07 +02:00
parent e3c17e9923
commit 2122b180e0

View File

@ -56,27 +56,6 @@ public class LockUtils {
} }
} }
public static void lock(@Nullable LeftRightLock lock, boolean right, @NotNull Runnable r) {
if (lock != null) {
if (right) {
lock.lockRight();
} else {
lock.lockLeft();
}
}
try {
r.run();
} finally {
if (lock != null) {
if (right) {
lock.releaseRight();
} else {
lock.releaseLeft();
}
}
}
}
public static void lockIO(@Nullable Lock lock, @NotNull IORunnable r) throws IOException { public static void lockIO(@Nullable Lock lock, @NotNull IORunnable r) throws IOException {
if (lock != null) { if (lock != null) {
lock.lock(); lock.lock();
@ -122,27 +101,6 @@ public class LockUtils {
} }
} }
public static void lockIO(@Nullable LeftRightLock lock, boolean right, @NotNull IORunnable r) throws IOException {
if (lock != null) {
if (right) {
lock.lockRight();
} else {
lock.lockLeft();
}
}
try {
r.run();
} finally {
if (lock != null) {
if (right) {
lock.releaseRight();
} else {
lock.releaseLeft();
}
}
}
}
public static <T> T lock(@Nullable Lock lock, @NotNull Supplier<T> r) { public static <T> T lock(@Nullable Lock lock, @NotNull Supplier<T> r) {
if (lock != null) { if (lock != null) {
lock.lock(); lock.lock();
@ -188,27 +146,6 @@ public class LockUtils {
} }
} }
public static <T> T lock(@Nullable LeftRightLock lock, boolean right, @NotNull Supplier<T> r) {
if (lock != null) {
if (right) {
lock.lockRight();
} else {
lock.lockLeft();
}
}
try {
return r.get();
} finally {
if (lock != null) {
if (right) {
lock.releaseRight();
} else {
lock.releaseLeft();
}
}
}
}
public static <T> T lockIO(@Nullable Lock lock, @NotNull IOSupplier<T> r) throws IOException { public static <T> T lockIO(@Nullable Lock lock, @NotNull IOSupplier<T> r) throws IOException {
if (lock != null) { if (lock != null) {
lock.lock(); lock.lock();
@ -253,25 +190,4 @@ public class LockUtils {
} }
} }
} }
public static <T> T lockIO(@Nullable LeftRightLock lock, boolean right, @NotNull IOSupplier<T> r) throws IOException {
if (lock != null) {
if (right) {
lock.lockRight();
} else {
lock.lockLeft();
}
}
try {
return r.get();
} finally {
if (lock != null) {
if (right) {
lock.releaseRight();
} else {
lock.releaseLeft();
}
}
}
}
} }