changeset 60:27123649e11f

*** empty log message ***
author pin
date Thu, 18 Oct 2007 13:27:23 +0900
parents aa47ea5bdac9
children e6806b2195d3
files src/sample/merge/TestSessionManager.java src/sample/merge/TestTranslate2.java
diffstat 2 files changed, 30 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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 <REPCommandPlus> commandList = new LinkedList<REPCommandPlus>();
+	List <REPCommandPlus> list = new LinkedList<REPCommandPlus>();
+	List<REPCommandPlus> commandList = Collections.synchronizedList(list);
 	List <TestEditor> editorList = new LinkedList<TestEditor>();
 	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{
--- 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();