fixed unit test bug
All checks were successful
CI / build (push) Successful in 24s

This commit is contained in:
2025-01-23 21:44:01 +08:00
parent 8f930d51a5
commit 1ab4c3144f

View File

@@ -2,7 +2,6 @@ package net.woggioni.jwo.lockfile.test;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import net.woggioni.jwo.LockFile; import net.woggioni.jwo.LockFile;
import net.woggioni.jwo.Run;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
@@ -16,20 +15,11 @@ public class LockFileTestMain {
boolean shared, boolean shared,
boolean keep boolean keep
) { ) {
Thread t = new Thread((Run)() -> {
try (AutoCloseable lockfile = LockFile.acquire(lockfilePath, shared)) {
while (keep) {
Thread.sleep(1000);
}
}
});
t.start();
try (AutoCloseable lockfile = LockFile.acquire(lockfilePath, shared)) { try (AutoCloseable lockfile = LockFile.acquire(lockfilePath, shared)) {
while (keep) { while (keep) {
Thread.sleep(1000); Thread.sleep(1000);
} }
} }
t.join();
} }
@SneakyThrows @SneakyThrows