Mercurial > hg > RemoteEditor > REPSessionManager
diff rep/ServerMainLoop.java @ 491:5945266c970d
before unMergedCmds fix , deadlockTimer API
author | one |
---|---|
date | Sat, 23 Oct 2010 12:34:46 +0900 |
parents | cc262a519b8a |
children |
line wrap: on
line diff
--- 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