Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Java Timer vs Windows preemption-any solutions?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
reply
    Bookmark Topic Watch Topic
  • New Topic