FreerailsSerializable[] items = moveQueue.read(); FreerailsSerializable[] principals = principalQueue.read();  for (int i = 0; i < items.length; i++) { Move move = (Move)items[i]; moveExecuter.processMove(move, (FreerailsPrincipal)principals[i]);
final LinkedList tmpMoves = new LinkedList(); final LinkedList tmpPrincipals = new LinkedList(); synchronized (moveQueue) { while (!moveQueue.isEmpty()) { tmpMoves.add(moveQueue.removeFirst()); tmpPrincipals.add(principalQueue.removeFirst()); } }  while (!tmpMoves.isEmpty()) { Move move = (Move) tmpMoves.removeFirst(); moveExecuter.processMove(move, (FreerailsPrincipal)tmpPrincipals.removeFirst());
    public void executeOutstandingMoves() {        FreerailsSerializable[] items = moveQueue.read();        FreerailsSerializable[] principals = principalQueue.read();        for (int i = 0; i < items.length; i++) {            Move move = (Move)items[i];            moveExecuter.processMove(move, (FreerailsPrincipal)principals[i]);        }    }