Skip to content

Commit

Permalink
Fix concurrency issue with AssetProducerThread.shutdown()
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvanderlinde committed Nov 18, 2024
1 parent aebe225 commit 9ee4cb9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/net/rptools/maptool/server/MapToolServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.Nullable;
import javax.swing.SwingUtilities;
import net.rptools.clientserver.ConnectionFactory;
Expand Down Expand Up @@ -536,15 +537,15 @@ public void shutdown() {
////
// CLASSES
private class AssetProducerThread extends Thread {
private boolean stop = false;
private final AtomicBoolean stop = new AtomicBoolean(false);

public AssetProducerThread() {
setName("AssetProducerThread");
}

@Override
public void run() {
while (!stop) {
while (!stop.get()) {
Entry<String, AssetTransferManager> entryForException = null;
try {
boolean lookForMore = false;
Expand Down Expand Up @@ -575,7 +576,7 @@ public void run() {
}

public void shutdown() {
stop = true;
stop.set(true);
}
}
}

0 comments on commit 9ee4cb9

Please sign in to comment.