# HG changeset patch # User pin # Date 1192681643 -32400 # Node ID 27123649e11f1cbae10dbae61e927f166639533e # Parent aa47ea5bdac9a6ac74ed00dc15e27f9e578fe991 *** empty log message *** diff -r aa47ea5bdac9 -r 27123649e11f src/sample/merge/TestSessionManager.java --- a/src/sample/merge/TestSessionManager.java Tue Sep 11 18:05:15 2007 +0900 +++ b/src/sample/merge/TestSessionManager.java Thu Oct 18 13:27:23 2007 +0900 @@ -1,20 +1,25 @@ package sample.merge; +import java.util.Collections; import java.util.LinkedList; import java.util.List; import remoteeditor.command.REPCommand; -import remoteeditor.command.REPCommandEvent; public class TestSessionManager extends Thread{ - List commandList = new LinkedList(); + List list = new LinkedList(); + List commandList = Collections.synchronizedList(list); List editorList = new LinkedList(); SMRoutingTable table = new SMRoutingTable(); private boolean go = true; + //private final int LIST_GET = 1; + //private final int LIST_ADD = 2; + //private final int LIST_REMOVE =3; - public synchronized void send(REPCommand command, TestEditor editor){ + public void send(REPCommand command, TestEditor editor){ REPCommandPlus commandp = new REPCommandPlus(command, editor); commandList.add(commandp); + //listOperation(LIST_ADD, commandp); } public void run() { @@ -22,9 +27,12 @@ if(commandList.size() > 0){ //int eid = commandList.get(0).getEID(); TestEditor editor = commandList.get(0).getEditor(); + //TestEditor editor = listOperation(LIST_GET, null).getEditor(); TestEditor nextEditor = table.getNextEditor(editor); if (nextEditor != null) nextEditor.CommandReceived(commandList.get(0).getCommand()); + //if(nextEditor !=null) nextEditor.CommandReceived(listOperation(LIST_GET, null).getCommand()); commandList.remove(0); + //listOperation(LIST_REMOVE, null); } } } @@ -37,6 +45,24 @@ public void setRun(boolean b) { go = b; } + +// public synchronized REPCommandPlus listOperation(int operation, REPCommandPlus commandp2){ +// REPCommandPlus editor2 = null; +// switch(operation){ +// case LIST_GET: +// editor2 = commandList.get(0); +// break; +// case LIST_ADD: +// commandList.add(commandp2); +// break; +// case LIST_REMOVE: +// commandList.remove(0); +// break; +// default: +// System.out.println("Select GET, ADD, REMOVE"); +// } +// return editor2; +// } } class REPCommandPlus{ diff -r aa47ea5bdac9 -r 27123649e11f src/sample/merge/TestTranslate2.java --- a/src/sample/merge/TestTranslate2.java Tue Sep 11 18:05:15 2007 +0900 +++ b/src/sample/merge/TestTranslate2.java Thu Oct 18 13:27:23 2007 +0900 @@ -33,7 +33,7 @@ editorB.changeText(REP.REP_INSERT_CMD, lineno, "exit"); try { - editorA.join(); // Thread.join() このスレッドが終了するのを待機します。(REPのjoinとは別) + editorA.join(); // Thread.join() : このスレッドが終了するのを待機します。(REPのjoinとは別) editorB.join(); // このスレッドが終了するのを待機します。 } catch (InterruptedException e) { e.printStackTrace();