开发者

java thread - how to have a thread that runs each second, and prefferably, in that thread have it do 1 action each 5 seconds?

开发者 https://www.devze.com 2023-02-18 01:22 出处:网络
I have a thread that runs each second with开发者_运维技巧 the sleep command. this works fine, but I\'d like to have it do certain actions every 5 seconds too. Both things should run at the same time..

I have a thread that runs each second with开发者_运维技巧 the sleep command. this works fine, but I'd like to have it do certain actions every 5 seconds too. Both things should run at the same time.. I've had problems starting a second thread in a first one...

any help please?

Thanks in advance!


See http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ScheduledExecutorService.html.

0

精彩评论

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