Mercurial > hg > RemoteEditor > REPSessionManager
comparison test/channeltest/testNetworkSimulator.java @ 196:b85525d83b46
*** empty log message ***
author | kono |
---|---|
date | Fri, 29 Aug 2008 21:39:13 +0900 |
parents | d03e34861a26 |
children | 4c0a94836357 |
comparison
equal
deleted
inserted
replaced
195:63f36334e8dc | 196:b85525d83b46 |
---|---|
13 private int NoSemaSlave; | 13 private int NoSemaSlave; |
14 private int NoEditor; | 14 private int NoEditor; |
15 static public REPLogger logger = REPLogger.singleton(); | 15 static public REPLogger logger = REPLogger.singleton(); |
16 | 16 |
17 public static void main(String[] args){ | 17 public static void main(String[] args){ |
18 REPServerSocketChannel.isSimulation = true; | 18 REPServerSocketChannel.isSimulation = false; |
19 testNetworkSimulator testns = new testNetworkSimulator(1, 0, 2); | 19 testNetworkSimulator testns = new testNetworkSimulator(1, 0, 2); |
20 logger.setLogLevel(5); | 20 logger.setLogLevel(5); |
21 | 21 |
22 testns.startTest(); | 22 testns.startTest(); |
23 } | 23 } |
52 host, masterPort+rand.nextInt(NoSemaMaster)); // random server address to connect | 52 host, masterPort+rand.nextInt(NoSemaMaster)); // random server address to connect |
53 semasList.add(sm); | 53 semasList.add(sm); |
54 sm.start(); | 54 sm.start(); |
55 } | 55 } |
56 logger.writeLog("all slave SessionManagers were created",1); | 56 logger.writeLog("all slave SessionManagers were created",1); |
57 synchronized (this) { | |
58 try { | |
59 wait(100); | |
60 } catch (InterruptedException e) { | |
61 } | |
62 } | |
57 for (int i=0; i<NoEditor; i++){ | 63 for (int i=0; i<NoEditor; i++){ |
58 testEditor te = new testEditor("Editor"+i,host, masterPort+rand.nextInt(NoSemaMaster+NoSemaSlave)); | 64 testEditor te = new testEditor("Editor"+i,host, masterPort+rand.nextInt(NoSemaMaster+NoSemaSlave)); |
59 editorList.add(te); | 65 editorList.add(te); |
60 te.start(); | 66 te.start(); |
61 } | 67 } |
64 | 70 |
65 try { | 71 try { |
66 for (testEditor te: editorList) | 72 for (testEditor te: editorList) |
67 te.join(); | 73 te.join(); |
68 logger.writeLog("main: all clients exited."); | 74 logger.writeLog("main: all clients exited."); |
75 for (testSeMa te: semaList) | |
76 te.join(); | |
77 for (testSeMaSlave te: semasList) | |
78 te.join(); | |
69 | 79 |
70 } catch (InterruptedException e) { | 80 } catch (InterruptedException e) { |
71 e.printStackTrace(); | 81 e.printStackTrace(); |
72 } | 82 } |
73 System.exit(0); | 83 //System.exit(0); |
74 } | 84 } |
75 | 85 |
76 public void Checker(){ | 86 public void Checker(){ |
77 | 87 |
78 } | 88 } |