理解原有的内部类实现线程的方式和@async的对比

public void listen() {
		while (true) {
			String answercard = answerCardDDao.bpopAnswer();
			// computeScore(answercard);
			threadPooltaskExecutor.execute(new InnerThread(answercard));
		}
	}

	class InnerThread implements Runnable {
		String answercardss;

		public InnerThread(String answercardss) {
			this.answercardss = answercardss;
		}

		@Override
		public void run() {
			computeScore(answercardss);
		}
	}

	private void computeScore(String answercardss) {
......}
@Async
	public void startProcess(LocalDate date) {
		List<Long> ids = orderService.getTodayOrder(date);
		for (Long id : ids)
			orderService.auto(id);
	}


posted @ 2018-04-28 18:39  車輪の唄  阅读(8)  评论(0编辑  收藏  举报  来源