Changeset 102 for branches/supervisor
- Timestamp:
- 10/14/13 16:38:34 (11 years ago)
- Location:
- branches/supervisor
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/supervisor/src/main/java/omq/common/util/OmqConnectionFactory.java
r83 r102 57 57 working = true; 58 58 } catch (Exception e) { 59 // e.printStackTrace(); 59 60 logger.error(e); 60 61 long milis = 2000; -
branches/supervisor/src/main/java/omq/common/util/ParameterQueue.java
r101 r102 132 132 */ 133 133 134 /**135 * Set how many threads will be created to invoke remote methods136 */137 public static String NUM_THREADS = "omq.num_threads";138 134 139 135 /** -
branches/supervisor/src/main/java/omq/server/InvocationThread.java
r101 r102 157 157 158 158 } 159 logger.info("ObjectMQ ('" + obj.getRef() + "') InvocationThread " + Thread.currentThread().getId() + " is killed"); 159 160 } 160 161 -
branches/supervisor/src/main/java/omq/server/RemoteThreadPool.java
r101 r102 4 4 import java.util.ArrayList; 5 5 import java.util.List; 6 import java.util.ListIterator; 6 7 import java.util.concurrent.atomic.AtomicInteger; 7 8 … … 102 103 long now = System.currentTimeMillis(); 103 104 104 int i = 0; 105 for (InvocationThread worker : workers) { 106 // Ensure there are at least minThreads available 107 if (workers.size() == minPoolThreads) { 108 break; 109 } 105 ListIterator<InvocationThread> lIter = workers.listIterator(); 106 while (workers.size() > minPoolThreads && lIter.hasNext()) { 107 InvocationThread worker = lIter.next(); 110 108 long lastExec = worker.getLastExecution(); 111 109 System.out.println("last - now = " + (now - lastExec) + " keep alive = " + keepAliveTime); … … 114 112 try { 115 113 worker.kill(); 116 workers.remove(i);114 lIter.remove(); 117 115 } catch (IOException e) { 118 // TODO Auto-generated catch block 119 e.printStackTrace(); 116 logger.error(e); 120 117 } 121 118 122 119 } 123 i++;124 120 } 125 121 } -
branches/supervisor/src/test/java/omq/test/lock/SleepTest.java
r92 r102 20 20 env.setProperty(ParameterQueue.RABBIT_HOST, "127.0.0.1"); 21 21 env.setProperty(ParameterQueue.RABBIT_PORT, "5672"); 22 env.setProperty(ParameterQueue.NUM_THREADS, "1");23 22 24 23 for (int i = 0; i < 4; i++) { -
branches/supervisor/src/test/java/omq/test/multiThread/ThreadTest.java
r89 r102 73 73 env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange"); 74 74 env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000"); 75 env.setProperty(ParameterQueue.NUM_THREADS, "4"); 75 env.setProperty(ParameterQueue.MIN_POOL_THREADS, "4"); 76 env.setProperty(ParameterQueue.MAX_POOL_THREADS, "4"); 76 77 77 78 RemoteMulti rm = new RemoteMulti(); -
branches/supervisor/src/test/java/omq/test/multiThread2/MultiThreadTest.java
r96 r102 21 21 env.setProperty(ParameterQueue.RABBIT_HOST, "127.0.0.1"); 22 22 env.setProperty(ParameterQueue.RABBIT_PORT, "5672"); 23 env.setProperty(ParameterQueue. NUM_THREADS, "4");24 23 env.setProperty(ParameterQueue.MIN_POOL_THREADS, "4"); 24 env.setProperty(ParameterQueue.MAX_POOL_THREADS, "4"); 25 25 SleepImpl sleep = new SleepImpl(); 26 26 -
branches/supervisor/src/test/java/omq/test/multiThread2/PrintTest.java
r97 r102 21 21 env.setProperty(ParameterQueue.RABBIT_HOST, "127.0.0.1"); 22 22 env.setProperty(ParameterQueue.RABBIT_PORT, "5672"); 23 env.setProperty(ParameterQueue.NUM_THREADS, "2"); 23 env.setProperty(ParameterQueue.MIN_POOL_THREADS, "2"); 24 env.setProperty(ParameterQueue.MAX_POOL_THREADS, "2"); 24 25 25 26 PrintImpl print = new PrintImpl(1); -
branches/supervisor/src/test/java/omq/test/remotePool/RemotePoolTest.java
r101 r102 47 47 for (int j = 0; j < 2; j++) { 48 48 49 for (int i = 0; i < 4; i++) {49 for (int i = 0; i < 8; i++) { 50 50 sleep.sleep(); 51 51 } 52 52 Thread.sleep(3000); 53 for (int i = 0; i < 4; i++) {53 for (int i = 0; i < 12; i++) { 54 54 sleep.sleep(); 55 55 } 56 56 Thread.sleep(10000); 57 57 } 58 Thread.sleep(20000 * 1000);58 59 59 } 60 60 } -
branches/supervisor/src/test/java/omq/test/supervisor/SleepTest.java
r96 r102 24 24 env1.setProperty(ParameterQueue.RABBIT_HOST, "127.0.0.1"); 25 25 env1.setProperty(ParameterQueue.RABBIT_PORT, "5672"); 26 env1.setProperty(ParameterQueue.NUM_THREADS, "4"); 26 env1.setProperty(ParameterQueue.MIN_POOL_THREADS, "4"); 27 env1.setProperty(ParameterQueue.MAX_POOL_THREADS, "4"); 27 28 28 29 Broker broker = new Broker(env1); … … 35 36 env2.setProperty(ParameterQueue.RABBIT_HOST, "127.0.0.1"); 36 37 env2.setProperty(ParameterQueue.RABBIT_PORT, "5672"); 37 env2.setProperty(ParameterQueue.NUM_THREADS, "1"); 38 env2.setProperty(ParameterQueue.MIN_POOL_THREADS, "4"); 39 env2.setProperty(ParameterQueue.MAX_POOL_THREADS, "4"); 38 40 39 41 Broker broker2 = new Broker(env2);
Note: See TracChangeset
for help on using the changeset viewer.