File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java timer task

 
srinivasu kondreddy
Greenhorn
Posts: 1
  • 0
  • 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: 20817
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • 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
Pie
Posts: 47216
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic