• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Java Timer vs Windows preemption-any solutions?

Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi Guys!

I have a quite big problem.
I have developed an app that include time count, and sometimes it loses concurrency. I have manage to find the source of it, I think it is cause by preemption of the windows. I have used both java Timer’s and try different configurations and threads but the time error always occur if I start to do something else while running my developed app. On 30 minutes time count I have approximately 4,5s error (Windows XP). When I do nothing else on the computer (mining I don’t click other programs) there is no time error. The error gets quite big running on Windows 7.
If there is some kind of way to minimize preemption of the windows (As I know there is no way to stop this mechanism).
Maybe I am wrong and the time count error is caused by something else.

Thanks for any help.
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your code? Ideally reduced to something that illustrates the problem?

One thing to note regarding java.util.Timer: "This class does not offer real-time guarantees: it schedules tasks using the Object.wait(long) method."
Pawel Szczepaniak
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I know about that note in awt timer, but I try both timer... on swing timer is the same
hear is simplified code (the error also occur during this code)

Maybe there is some kind of more occur method of time count?
I have checked an when I change the priority of my app in windows task manager priority to RealTime there is absolutely no error. Is there some way to set tis parameter permanently from java code? If not how to change it permanently from windows? I have tried:

But it doesn’t start the java app. Does somebody know any working solution?
I found a beautiful pie. And a tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic