()
| 99 | |
| 100 | |
| 101 | @Override |
| 102 | public void run() { |
| 103 | |
| 104 | long counter = 0; |
| 105 | long total = 0; |
| 106 | LoadMessage msg = new LoadMessage(); |
| 107 | |
| 108 | try { |
| 109 | startTest(); |
| 110 | while (total < msgCount) { |
| 111 | if (channel.getMembers().length == 0 || (!send)) { |
| 112 | synchronized (mutex) { |
| 113 | try { |
| 114 | mutex.wait(); |
| 115 | } catch (InterruptedException x) { |
| 116 | log.info("Thread interrupted from wait"); |
| 117 | } |
| 118 | } |
| 119 | } else { |
| 120 | try { |
| 121 | // msg.setMsgNr((int)++total); |
| 122 | counter++; |
| 123 | if (debug) { |
| 124 | printArray(msg.getMessage()); |
| 125 | } |
| 126 | channel.send(channel.getMembers(), msg, channelOptions); |
| 127 | if (pause > 0) { |
| 128 | if (debug) { |
| 129 | System.out.println("Pausing sender for " + pause + " ms."); |
| 130 | } |
| 131 | Thread.sleep(pause); |
| 132 | } |
| 133 | } catch (ChannelException x) { |
| 134 | if (debug) { |
| 135 | log.error("Unable to send message:" + x.getMessage(), x); |
| 136 | } |
| 137 | log.error("Unable to send message:" + x.getMessage()); |
| 138 | ChannelException.FaultyMember[] faulty = x.getFaultyMembers(); |
| 139 | for (ChannelException.FaultyMember faultyMember : faulty) { |
| 140 | log.error("Faulty: " + faultyMember); |
| 141 | } |
| 142 | --counter; |
| 143 | if (this.breakonChannelException) { |
| 144 | throw x; |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 | if ((counter % statsInterval) == 0 && (counter > 0)) { |
| 149 | // add to the global counter |
| 150 | counter = addSendStats(counter); |
| 151 | // print from the global counter |
| 152 | // printSendStats(LoadTest.messagesSent, LoadTest.messageSize, LoadTest.messageSendTime); |
| 153 | printSendStats(messagesSent, messageSize); |
| 154 | |
| 155 | } |
| 156 | |
| 157 | } |
| 158 | } catch (Exception x) { |
no test coverage detected