mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 21:56:33 +01:00
synchronize on block map access
This commit is contained in:
parent
116a1869b1
commit
6408320843
@ -43,15 +43,19 @@ public class DefaultFaweQueueMap implements IFaweQueueMap {
|
||||
|
||||
@Override
|
||||
public Collection<FaweChunk> getFaweCunks() {
|
||||
synchronized (blocks) {
|
||||
return new HashSet<>(blocks.values());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachChunk(RunnableVal<FaweChunk> onEach) {
|
||||
synchronized (blocks) {
|
||||
for (Map.Entry<Long, FaweChunk> entry : blocks.entrySet()) {
|
||||
onEach.run(entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaweChunk getFaweChunk(int cx, int cz) {
|
||||
|
@ -47,6 +47,7 @@ public class WeakFaweQueueMap implements IFaweQueueMap {
|
||||
@Override
|
||||
public Collection<FaweChunk> getFaweCunks() {
|
||||
HashSet<FaweChunk> set = new HashSet<>();
|
||||
synchronized (blocks) {
|
||||
Iterator<Map.Entry<Long, Reference<FaweChunk>>> iter = blocks.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Map.Entry<Long, Reference<FaweChunk>> entry = iter.next();
|
||||
@ -60,9 +61,11 @@ public class WeakFaweQueueMap implements IFaweQueueMap {
|
||||
}
|
||||
return set;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachChunk(RunnableVal<FaweChunk> onEach) {
|
||||
synchronized (blocks) {
|
||||
Iterator<Map.Entry<Long, Reference<FaweChunk>>> iter = blocks.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Map.Entry<Long, Reference<FaweChunk>> entry = iter.next();
|
||||
@ -75,6 +78,7 @@ public class WeakFaweQueueMap implements IFaweQueueMap {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaweChunk getFaweChunk(int cx, int cz) {
|
||||
|
Loading…
Reference in New Issue
Block a user