Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to substitute a Timer for ScheduledThreadExecutor  RSS feed

 
Jake Kowalski
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


How to replace this code:



With a ScheduledThreadExecutor

EDIT: Here is what happens in startSync();


 
Stephan van Hulst
Saloon Keeper
Posts: 6980
110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Executors has methods that return a ScheduledExecutorService, which in turn has the scheduleAtFixedRate() method.

P.S. I don't think it's a good idea to set the priority of the thread inside the task. You should provide Executors with a ThreadFactory that initializes the Thread correctly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!