1

I am trying to create a platform for clients to run their Runnable objects at a specified rate endlessly. I have the following code:

public class Health
{
    public Health(Runnable r, int rate)
    {
       // I want to fork a new thread and then run the Runnable at the 
       // specified rate. How ??
    }
}

Clients would create a bean of Health with their own Runnable and rate. How can I accomplish this.

User_Targaryen
  • 4,125
  • 4
  • 30
  • 51
  • Java already has this built-in; take a look at [`java.util.concurrent.ScheduledExecutorService`](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ScheduledExecutorService.html) – Jesper May 19 '16 at 11:23

0 Answers0