• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java timer task

 
srinivasu kondreddy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using java timer task in my project. I am using scheduleAtFixedRate() method. If i am scheduling more tasks , some times newly schedule tasks are not running(control is not comming to run method) untill finishing the earlier tasks. Any body can help me to reslove this problem. please educate me how many tasks i can run simultaniusly . Is ther any chance to find newly schedule task status?

Regards,
Srinu.k.
 
Henry Wong
author
Marshal
Pie
Posts: 21016
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java.util.Timer class only has one thread to run the tasks. Hence, it is not possible to run the next task, until the previous one finishes. If you want to schedule into more than one thread, take a look at java.util.concurrent.ScheduledThreadPoolExecutor class.

However, even in this case, i don't think it will schedule the same task to run again, if the previous iteration is not complete.

Henry
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic