Mercurial > hg > RemoteEditor > REPSessionManager
changeset 459:66c4f6b29baf
fix getWriteQueue
author | one |
---|---|
date | Fri, 24 Sep 2010 03:24:06 +0900 |
parents | c22f6833d736 |
children | ef70109af810 |
files | rep/ServerMainLoop.java rep/handler/Editor.java |
diffstat | 2 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/rep/ServerMainLoop.java Fri Sep 24 02:41:13 2010 +0900 +++ b/rep/ServerMainLoop.java Fri Sep 24 03:24:06 2010 +0900 @@ -5,7 +5,6 @@ import java.net.SocketException; import java.nio.channels.ClosedChannelException; import java.nio.channels.SelectionKey; -import java.util.Collection; import java.util.LinkedList; import java.util.Set; import java.util.concurrent.BlockingQueue; @@ -130,7 +129,7 @@ LinkedList<PacketSet> w = new LinkedList<PacketSet>(); for(PacketSet p:writeQueue) { if (p.channel==editor) { - editor.addWaitingCommand(p); + editor.waitingCommandInMerge.addLast(p); } else { w.addLast(p); }
--- a/rep/handler/Editor.java Fri Sep 24 02:41:13 2010 +0900 +++ b/rep/handler/Editor.java Fri Sep 24 03:24:06 2010 +0900 @@ -18,7 +18,7 @@ private Translator translator; // REPCommands we are going to send to the next editor private LinkedList<REPCommand> sentList = new LinkedList<REPCommand>(); - protected LinkedList<PacketSet> waitingCommandInMerge= new LinkedList<PacketSet>(); + public LinkedList<PacketSet> waitingCommandInMerge= new LinkedList<PacketSet>(); private REPCommand quit2=null; private REPCommand preMergeCommand; private boolean merging; @@ -183,8 +183,6 @@ // } // } waitingCommandInMerge.addLast(set); - // to preserve command order, move all elements from manager's writing queue - manager.getWriteQueue(this); ServerMainLoop.logger.writeLog("Editor eid:"+eid+" waitingCommandInMerge = "+waitingCommandInMerge); } @@ -491,6 +489,8 @@ if (translator==null||isMerging()) return; while(waitingCommandInMerge.size()>0) { if (merging||isMerging()) return; + // to preserve command order, move all elements from manager's writing queue + manager.getWriteQueue(this); PacketSet p = waitingCommandInMerge.remove(0); REPCommand command = p.command; try {