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.
精彩评论