@Component public class MailUtility { @Async public void sendMail(String name){ System.out.println(” I Will be formatting html mail and sending it “); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(” Asynchronous method call of send email — Complete “); } } <p class="indent">
[该贴被banq于2010-01-14 10:19修改过]
使用future实现内置异步API
[该贴被banq于2010-01-19 11:39修改过]