简体   繁体   English

如何在线程中使用计时器

[英]How to use timer in a thread

I would like to send email notifications to users of my project exactly at 8 am, Here we are using a thread to send emails to the user. 我想精确地在上午8点向我的项目用户发送电子邮件通知。在这里,我们正在使用一个线程向用户发送电子邮件。 I would like to send some emails exactly at 8 AM How can I execute that perticular logic in this Thread. 我想精确地在上午8点发送一些电子邮件。如何在此线程中执行垂直的逻辑。 Please help me. 请帮我。

The java ScheduledExecutorService should be helpful here. Java ScheduledExecutorService在这里应该会有所帮助。

http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ScheduledExecutorService.html http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ScheduledExecutorService.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM