Skip to content

Commit fd57ed5

Browse files
committed
Add synchronization to closing FileWatchers. Fixes: #655
1 parent 449fcf3 commit fd57ed5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

common/src/main/java/de/bluecolored/bluemap/common/plugin/MapUpdateService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ public void run() {
8181
}
8282

8383
private synchronized void updateRegion(Vector2i regionPos) {
84+
if (closed) return;
85+
8486
// we only want to start the render when there were no changes on a file for 5 seconds
8587
TimerTask task = scheduledUpdates.remove(regionPos);
8688
if (task != null) task.cancel();
@@ -101,7 +103,7 @@ public void run() {
101103
delayTimer.schedule(task, 5000);
102104
}
103105

104-
public void close() {
106+
public synchronized void close() {
105107
this.closed = true;
106108
this.interrupt();
107109

0 commit comments

Comments
 (0)