0

I have a method with @Scheduled annotation. This method contains long running, expensive operations. I'm afraid that the application slows down when the scheduled method starts running. Is there any way to assign a priority to the scheduled method? What is the best practice to start a low priority background process in Spring?

M. Deinum
  • 115,695
  • 22
  • 220
  • 224
Imreking
  • 309
  • 1
  • 2
  • 13
  • Maybe instead of @Scheduled you should send it to JMS? Please take a look at this question: http://stackoverflow.com/questions/1035949/real-world-use-of-jms-message-queues. – BlueLettuce16 Nov 07 '14 at 13:03

1 Answers1

2

You can use the setThreadPriority method on the task scheduler. This will set the priority for all Threads in the underlying pool. See java.lang.thread for pre-defined priorities.

lewthor
  • 404
  • 2
  • 5