提交 c819250f authored 作者: Thomas Mueller's avatar Thomas Mueller

Closing the file lock will now wait until the background thread is stopped.

上级 f730a281
......@@ -79,6 +79,11 @@ public class FileLock implements Runnable {
*/
private volatile ServerSocket serverSocket;
/**
* Whether the file is locked.
*/
private volatile boolean locked;
/**
* The number of milliseconds to sleep after checking a file.
*/
......@@ -96,7 +101,6 @@ public class FileLock implements Runnable {
private String method, ipAddress;
private Properties properties;
private boolean locked;
private String uniqueId;
private Thread watchdog;
......@@ -152,6 +156,7 @@ public class FileLock implements Runnable {
try {
if (watchdog != null) {
watchdog.interrupt();
watchdog.join();
}
} catch (Exception e) {
trace.debug(e, "unlock");
......@@ -484,7 +489,7 @@ public class FileLock implements Runnable {
@Override
public void run() {
try {
while (fileName != null) {
while (locked && fileName != null) {
// trace.debug("watchdog check");
try {
if (!FileUtils.exists(fileName) || FileUtils.lastModified(fileName) != lastWrite) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论