Search code examples
javamultithreadingrunnable

What it is the Best implementation for 3 Threads started by another one


I need to implement this situation on Java:

I have 3 Threads for 3 different actions. Each action have to be executed in a different time. For example, action 1 it must run every 60min, action 2, have to be run every 40min and action 3 it must run every 120min.

Then, I have one Thread to call the other 3 Threads

What it is the Best implementation?

Use Timer?, Use Runnable?

Made a "While true" and inside do a GetTime and compare to know if I have to run some of the Thread?

Or maybe Sleep the Main Thread?

Thanks for the ideas and sorry for my poor english


Solution

  • You can use Quartz API for that, http://quartz-scheduler.org/ this URL will help you.