How to set 1min interval time logic in java -
i stuck on 1 problem: want send useraccountname , password via mail, 1 minute interval between. is, useraccountname should go sent first via mail, , after 1 minute interval should sent too.
how implement logic 1 minute interval in java?
you can use scheduledexecutorservice
. allows queue tasks given time intervals.
example
you create runnable
..
runnable runnable = new runnable() { public void run() { system.out.println("do something!"); } } scheduledexecutorservice scheduler = executors.newscheduledthreadpool(1); scheduler.scheduleatfixedrate() // won't tell how this!
Comments
Post a Comment