• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to substitute a Timer for ScheduledThreadExecutor

 
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
Bartender
Posts: 6583
84
  • 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!