[Fix] Allow to flush TX while doing commands

This commit is contained in:
Robert von Burg 2018-08-27 14:24:58 +02:00
parent bce72f76f6
commit 458706d8fc
1 changed files with 8 additions and 1 deletions

View File

@ -1493,7 +1493,14 @@ public abstract class AbstractTransaction implements StrolchTransaction {
* so chance of a runtime exception should be small
*/
private void doCommands() {
ListIterator<Command> iter = this.commands.listIterator();
// keep track of the current list of commands
List<Command> commands = this.commands;
// assign a new list for in case a command adds new commands
this.commands = new ArrayList<>();
ListIterator<Command> iter = commands.listIterator();
while (iter.hasNext()) {
Command command = iter.next();
this.flushedCommands.add(command);