开发者

make new thread for send mail Id in java

开发者 https://www.devze.com 2023-01-28 16:15 出处:网络
I am working in online application, in which there is facility of creating group. I want facility to send mail to all group user when any activity done in group. like comments , start new discussion e

I am working in online application, in which there is facility of creating group. I want facility to send mail to all group user when any activity done in group. like comments , start new discussion etc.开发者_如何学Python But problem is that . if any small activity i send thorusand of mail at run time. it slow the performance.

For that i am thinking to create new independent thread. to send mail which send mail to thousand of user and main thead with out any problem come to group page.

How i will make new thread in class. thanks in advances.

for more info visit http://www.rameshsengani.in


new Thread(new Runnable() {
    @Override
    public void run() {
       // do stuff here
    }
}).start();

This is the accepted Java pre-1.5 way. You can take a look at the java.util.concurrent package and the executor framework.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号