Mercurial > hg > RemoteEditor > REPSessionManager
comparison rep/handler/Editor.java @ 407:de4ef4313adc current-release
looks like working...
author | one |
---|---|
date | Tue, 25 Nov 2008 17:54:54 +0900 |
parents | 8009dd7b2013 |
children | 2724cf17e9f3 |
comparison
equal
deleted
inserted
replaced
406:8009dd7b2013 | 407:de4ef4313adc |
---|---|
21 protected LinkedList<PacketSet> waitingCommandInMerge= new LinkedList<PacketSet>(); | 21 protected LinkedList<PacketSet> waitingCommandInMerge= new LinkedList<PacketSet>(); |
22 private REPCommand quit2=null; | 22 private REPCommand quit2=null; |
23 private boolean merging; | 23 private boolean merging; |
24 private REPCommand preMergeCommand; | 24 private REPCommand preMergeCommand; |
25 public static boolean noMergeMode=false; | 25 public static boolean noMergeMode=false; |
26 static final boolean doOptimize = true; | 26 static final boolean doOptimize = false; |
27 | 27 |
28 public Editor(SessionManager manager,int editorNo){ | 28 public Editor(SessionManager manager,int editorNo){ |
29 // no translator case | 29 // no translator case |
30 super(manager, null); | 30 super(manager, null); |
31 } | 31 } |
129 return true; | 129 return true; |
130 } else if (isMerging()) { | 130 } else if (isMerging()) { |
131 addWaitingCommand(new PacketSet(getChannel(), this, new REPCommand(command))); | 131 addWaitingCommand(new PacketSet(getChannel(), this, new REPCommand(command))); |
132 return true; | 132 return true; |
133 } | 133 } |
134 ServerMainLoop.logger.writeLog("Editor eid:"+eid+" no waiting"); | 134 //ServerMainLoop.logger.writeLog("Editor eid:"+eid+" no waiting"); |
135 return false; | 135 return false; |
136 } | 136 } |
137 | 137 |
138 public void addWaitingCommand(PacketSet set) { | 138 public void addWaitingCommand(PacketSet set) { |
139 if (preMergeCommand!=null) { | 139 if (preMergeCommand!=null) { |
146 } | 146 } |
147 | 147 |
148 private void sendEditorCommand(REPCommand command) { | 148 private void sendEditorCommand(REPCommand command) { |
149 REPCommand keep = new REPCommand(command); | 149 REPCommand keep = new REPCommand(command); |
150 sentList.add(keep); | 150 sentList.add(keep); |
151 ServerMainLoop.logger.writeLog("Editor eid:"+eid+" sentList = "+sentList); | 151 //ServerMainLoop.logger.writeLog("Editor eid:"+eid+" sentList = "+sentList); |
152 assert(sentList.size()<limit); | 152 assert(sentList.size()<limit); |
153 next.send(command); | 153 next.send(command); |
154 } | 154 } |
155 | 155 |
156 boolean merge(REPCommand command) { | 156 boolean merge(REPCommand command) { |
262 case REPCMD_INSERT: keep.cmd = REP.REPCMD_INSERT_ACK;break; | 262 case REPCMD_INSERT: keep.cmd = REP.REPCMD_INSERT_ACK;break; |
263 case REPCMD_DELETE: keep.cmd = REP.REPCMD_DELETE_ACK;break; | 263 case REPCMD_DELETE: keep.cmd = REP.REPCMD_DELETE_ACK;break; |
264 default: assert(false); | 264 default: assert(false); |
265 } | 265 } |
266 sentList.add(keep); | 266 sentList.add(keep); |
267 ServerMainLoop.logger.writeLog("Editor eid:"+eid+" sentList = "+sentList); | 267 //ServerMainLoop.logger.writeLog("Editor eid:"+eid+" sentList = "+sentList); |
268 assert(sentList.size()<limit); | 268 assert(sentList.size()<limit); |
269 next.send(keep); | 269 next.send(keep); |
270 } else { | 270 } else { |
271 next.send(preMergeCommand); | 271 next.send(preMergeCommand); |
272 } | 272 } |