mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-24 11:36:52 +01:00
Forgot to flush changeset for VS
This commit is contained in:
parent
dba271ba78
commit
9f93f56c05
@ -333,7 +333,7 @@ public abstract class FaweQueue {
|
||||
* Lock the thread until the queue is empty
|
||||
*/
|
||||
public void flush() {
|
||||
flush(Integer.MAX_VALUE);
|
||||
flush(10000);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -344,21 +344,22 @@ public abstract class FaweQueue {
|
||||
if (Fawe.get().isMainThread()) {
|
||||
SetQueue.IMP.flush(this);
|
||||
} else {
|
||||
enqueue();
|
||||
final AtomicBoolean running = new AtomicBoolean(true);
|
||||
addNotifyTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TaskManager.IMP.notify(running);
|
||||
}
|
||||
});
|
||||
TaskManager.IMP.wait(running, time);
|
||||
if (enqueue()) {
|
||||
final AtomicBoolean running = new AtomicBoolean(true);
|
||||
addNotifyTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TaskManager.IMP.notify(running);
|
||||
}
|
||||
});
|
||||
TaskManager.IMP.wait(running, time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void enqueue() {
|
||||
SetQueue.IMP.enqueue(this);
|
||||
public boolean enqueue() {
|
||||
return SetQueue.IMP.enqueue(this);
|
||||
}
|
||||
|
||||
public void dequeue() {
|
||||
|
@ -235,7 +235,7 @@ public class DelegateFaweQueue extends FaweQueue {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enqueue() {
|
||||
parent.enqueue();
|
||||
public boolean enqueue() {
|
||||
return parent.enqueue();
|
||||
}
|
||||
}
|
||||
|
@ -140,12 +140,16 @@ public class SetQueue {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void enqueue(FaweQueue queue) {
|
||||
public boolean enqueue(FaweQueue queue) {
|
||||
inactiveQueues.remove(queue);
|
||||
if (queue.size() > 0 && !activeQueues.contains(queue)) {
|
||||
queue.optimize();
|
||||
activeQueues.add(queue);
|
||||
if (queue.size() > 0) {
|
||||
if (!activeQueues.contains(queue)) {
|
||||
queue.optimize();
|
||||
activeQueues.add(queue);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void dequeue(FaweQueue queue) {
|
||||
|
@ -270,9 +270,13 @@ public abstract class TaskManager {
|
||||
|
||||
public void wait(AtomicBoolean running, int timout) {
|
||||
try {
|
||||
long start = System.currentTimeMillis();
|
||||
synchronized (running) {
|
||||
while (running.get()) {
|
||||
running.wait(timout);
|
||||
if (running.get() && System.currentTimeMillis() - start > Settings.QUEUE.DISCARD_AFTER_MS) {
|
||||
MainUtil.stacktrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
|
@ -465,6 +465,8 @@ public class LocalSession {
|
||||
}
|
||||
}
|
||||
FaweChangeSet changeSet = (FaweChangeSet) editSession.getChangeSet();
|
||||
// Just in case
|
||||
changeSet.flush();
|
||||
historySize += MainUtil.getSize(changeSet);
|
||||
if (append) {
|
||||
history.add(changeSet);
|
||||
|
Loading…
Reference in New Issue
Block a user