changeset 491:5945266c970d

before unMergedCmds fix , deadlockTimer API
author one
date Sat, 23 Oct 2010 12:34:46 +0900
parents 168909388479
children d2afd4efdd2d
files Todo rep/ServerMainLoop.java test/sematest/TestSessionManager.java
diffstat 3 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Todo	Sat Oct 23 02:56:20 2010 +0900
+++ b/Todo	Sat Oct 23 12:34:46 2010 +0900
@@ -1,3 +1,15 @@
+Sat Oct 23 12:04:43 JST 2010
+
+sentList から外すときに、unMergeCmds からも外すのだが、その時に、merge command が
+外れないらしい。
+
+   それっぽいものをunMergedCmdsから外す
+   unMergedCmds に sentList との対応を足す
+   そもそも、unMergedCmds = reverse(sentList) なはず (merge中以外)
+   unMergedCmds を廃止 (merge 時は、sentMergeList を使う)
+
+とか言う手を思い付きますが…
+
 Thu Oct 21 12:27:44 JST 2010
 
 外部からのINESRT に USER_INSERTがはまりこんでいるが…
--- a/rep/ServerMainLoop.java	Sat Oct 23 02:56:20 2010 +0900
+++ b/rep/ServerMainLoop.java	Sat Oct 23 12:34:46 2010 +0900
@@ -43,6 +43,8 @@
 	protected static final int DEFAULT_PORT = 8766;
 	private SessionManagerEvent execAfterConnect = null;
 	private boolean running = true;
+	// dead lock detection in msec, -1 means no deadlock detection
+	public int deadlockTime = -1;
 
 
 	public void setReceivePort(int port) {
@@ -59,7 +61,7 @@
 	}
 	
 	public void mainLoop() throws IOException {
-		int deadlock = 0;
+		int deadlock = deadlockTime;
 		while(running){
 			manager.checkWaitingCommandInMerge();
 			if (checkInputEvent() ||
@@ -70,9 +72,9 @@
 				   //continue;
 			}
 			// now we can wait for input packet or event
-			if (deadlock++>1000) deadlockDetected();
+			if (deadlock-- ==0) deadlockDetected();
 			selector.select(1);
-			if (select()) deadlock=0;
+			if (select()) deadlock=deadlockTime;
 		}
 	}
 
@@ -277,5 +279,9 @@
 	public void setManager(SessionManager sessionManager) {
 		manager = sessionManager;
 	}
+	
+	public void setDeadlockTime(int t) {
+		deadlockTime = t;
+	}
 
 }
\ No newline at end of file
--- a/test/sematest/TestSessionManager.java	Sat Oct 23 02:56:20 2010 +0900
+++ b/test/sematest/TestSessionManager.java	Sat Oct 23 12:34:46 2010 +0900
@@ -86,6 +86,7 @@
 		Runnable start = new Runnable() {
 			public void run() {		
 				try {
+					sm.setDeadlockTime(1000);
 					sm.init(port1,gui);
 				} catch (IOException e) {
 				} catch (InterruptedException e) {