public void waitForMessageConsume(int timeoutMills) { TestUtil.waitForMonment(timeoutMills); }
public void waitForResponse(int timeoutMills) { long startTime = System.currentTimeMillis(); while (this.successSendResult.size() != this.msgSize) { if (System.currentTimeMillis() - startTime < timeoutMills) { TestUtil.waitForMonment(100); } else { logger.info("timeout but still not recv all response!"); break; } } }
public void send(long msgNum, int intervalMills) { for (int i = 0; i < msgNum; i++) { this.send(); TestUtil.waitForMonment(intervalMills); } }
public Collection<Object> waitForMessageConsume(Collection<Object> allSendMsgs, int timeoutMills) { this.allSendMsgs = allSendMsgs; List<Object> sendMsgs = new ArrayList<Object>(); sendMsgs.addAll(allSendMsgs); long curTime = System.currentTimeMillis(); while (!sendMsgs.isEmpty()) { Iterator<Object> iter = sendMsgs.iterator(); while (iter.hasNext()) { Object msg = iter.next(); if (msgBodys.getAllData().contains(msg)) { iter.remove(); } } if (sendMsgs.isEmpty()) { break; } else { if (System.currentTimeMillis() - curTime >= timeoutMills) { logger.error(String.format("timeout but [%s] not recv all send messages!", listenerName)); break; } else { logger.info(String.format("[%s] still [%s] msg not recv!", listenerName, sendMsgs.size())); TestUtil.waitForMonment(500); } } } return sendMsgs; }
public void send(String tag, int msgSize, int intervalMills) { for (int i = 0; i < msgSize; i++) { Object msg = getMessageByTag(tag); send(msg, null); TestUtil.waitForMonment(intervalMills); } }
public long waitForMessageConsume(int size, int timeoutMills) { long curTime = System.currentTimeMillis(); while (true) { if (msgBodys.getDataSize() >= size) { break; } if (System.currentTimeMillis() - curTime >= timeoutMills) { logger.error(String.format("timeout but [%s] not recv all send messages!", listenerName)); break; } else { logger.info(String.format("[%s] still [%s] msg not recv!", listenerName, size - msgBodys.getDataSize())); TestUtil.waitForMonment(500); } } return msgBodys.getDataSize(); }
public void waitForMessageConsume(int timeoutMills) { TestUtil.waitForMonment(timeoutMills); }
public void waitForResponse(int timeoutMills) { long startTime = System.currentTimeMillis(); while (this.successSendResult.size() != this.msgSize) { if (System.currentTimeMillis() - startTime < timeoutMills) { TestUtil.waitForMonment(100); } else { logger.info("timeout but still not recv all response!"); break; } } }
public void run() { for (int i = 0; i < msgNum; i++) { if (!bPause.get()) { producer.send(); TestUtil.waitForMonment(intervalMills); } else { while (true) { if (bPause.get()) { TestUtil.waitForMonment(10); } else break; } } } } });
public static void setCondition(Condition condition, int waitTimeMills, int intervalMills) { long startTime = System.currentTimeMillis(); while (!condition.meetCondition()) { if (System.currentTimeMillis() - startTime > waitTimeMills) { logger.error("time out,but contidion still not meet!"); break; } else { TestUtil.waitForMonment(intervalMills); } } }
public void send(long msgNum, int intervalMills) { for (int i = 0; i < msgNum; i++) { this.send(); TestUtil.waitForMonment(intervalMills); } }
public void waitSendAll(int waitMills) { long startTime = System.currentTimeMillis(); while ((producer.getAllMsgBody().size() + producer.getSendErrorMsg().size()) < msgNum) { if (System.currentTimeMillis() - startTime < waitMills) { TestUtil.waitForMonment(200); } else { logger.error(String.format("time elapse:%s, but the message sending has not finished", System.currentTimeMillis() - startTime)); break; } } }
public Collection<Object> waitForMessageConsume(Collection<Object> allSendMsgs, int timeoutMills) { this.allSendMsgs = allSendMsgs; List<Object> sendMsgs = new ArrayList<Object>(); sendMsgs.addAll(allSendMsgs); long curTime = System.currentTimeMillis(); while (!sendMsgs.isEmpty()) { Iterator<Object> iter = sendMsgs.iterator(); while (iter.hasNext()) { Object msg = iter.next(); if (msgBodys.getAllData().contains(msg)) { iter.remove(); } } if (sendMsgs.isEmpty()) { break; } else { if (System.currentTimeMillis() - curTime >= timeoutMills) { logger.error(String.format("timeout but [%s] not recv all send messages!", listenerName)); break; } else { logger.info(String.format("[%s] still [%s] msg not recv!", listenerName, sendMsgs.size())); TestUtil.waitForMonment(500); } } } return sendMsgs; }
public void send(String tag, int msgSize, int intervalMills) { for (int i = 0; i < msgSize; i++) { Object msg = getMessageByTag(tag); send(msg, null); TestUtil.waitForMonment(intervalMills); } }
public long waitForMessageConsume(int size, int timeoutMills) { long curTime = System.currentTimeMillis(); while (true) { if (msgBodys.getDataSize() >= size) { break; } if (System.currentTimeMillis() - curTime >= timeoutMills) { logger.error(String.format("timeout but [%s] not recv all send messages!", listenerName)); break; } else { logger.info(String.format("[%s] still [%s] msg not recv!", listenerName, size - msgBodys.getDataSize())); TestUtil.waitForMonment(500); } } return msgBodys.getDataSize(); }
} catch (Throwable e) { TestUtil.waitForMonment(500); } else { logger.error(String.format(
public void run() { for (int i = 0; i < msgNum; i++) { if (!bPause.get()) { producer.send(); TestUtil.waitForMonment(intervalMills); } else { while (true) { if (bPause.get()) { TestUtil.waitForMonment(10); } else break; } } } } });
public static void setCondition(Condition condition, int waitTimeMills, int intervalMills) { long startTime = System.currentTimeMillis(); while (!condition.meetCondition()) { if (System.currentTimeMillis() - startTime > waitTimeMills) { logger.error("time out,but contidion still not meet!"); break; } else { TestUtil.waitForMonment(intervalMills); } } }
public void waitSendAll(int waitMills) { long startTime = System.currentTimeMillis(); while ((producer.getAllMsgBody().size() + producer.getSendErrorMsg().size()) < msgNum) { if (System.currentTimeMillis() - startTime < waitMills) { TestUtil.waitForMonment(200); } else { logger.error(String.format("time elapse:%s, but the message sending has not finished", System.currentTimeMillis() - startTime)); break; } } }
} catch (Throwable e) { TestUtil.waitForMonment(500); } else { logger.error(String.format(