/** @see java.util.TimerTask#run() */ public void run() { if (!_ended) { synchronized (_done) { int _sendCount = 0; for (int i = 0; i < _done.length && _sendCount < _numTx; i++) { if (!_done[i]) { Partner p = _partners.get(i); while (!p.hasFinishedTx() && _sendCount < _numTx) { // spawn thread to send for this partner p.incrementCounter(); SendThread t = new SendThread(p); _sendCount++; t.start(); } if (p.hasFinishedTx()) { _done[i] = true; logger.log(Level.INFO, "Finished sending all tx to partner " + p.getId()); } } } if (_sendCount < _numTx) { logger.log(Level.INFO, "Finished sending all tx to all partners"); stop(); logger.log(Level.INFO, "Test case " + _testCaseId + " finished at " + new Date()); } } } else { logger.log(Level.INFO, "Send timer has been cancelled."); } }
private void lanchApp() { SendThread th = new SendThread(); th.start(); }