Skip to content
Snippets Groups Projects
Commit 619f4ab6 authored by Cookiebowser's avatar Cookiebowser
Browse files

changed states-set to ConcurrentHashSet in JavaTemplate

parent d5605e8a
No related branches found
No related tags found
1 merge request!28Rust support
......@@ -15,6 +15,7 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.Future;
import java.util.concurrent.Executors;
......@@ -1187,7 +1188,7 @@ private static class ModelChecker {
private final boolean isDebug;
private final LinkedList\<<machine>\> unvisitedStates = new LinkedList\<>();
private final Set\<<machine>\> states = new HashSet\<>();
private final Set\<<machine>\> states = ConcurrentHashMap.newKeySet();
private AtomicInteger transitions = new AtomicInteger(0);
private ThreadPoolExecutor threadPool;
private Object waitLock = new Object();
......@@ -1485,9 +1486,7 @@ private void modelCheckMultiThreaded() {
Set\<<machine>\> nextStates = generateNextStates(state);
nextStates.forEach(nextState -> {
synchronized (states) {
if(!states.contains(nextState)) {
states.add(nextState);
if(states.add(nextState)) {
synchronized (unvisitedStates) {
unvisitedStates.add(nextState);
}
......@@ -1497,7 +1496,6 @@ private void modelCheckMultiThreaded() {
System.out.println("-------------------");
}
}
}
});
synchronized (unvisitedStates) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment