package executorServices;

import chapter8.TakeABreak;

public class ExampleRunnable implements Runnable {
    int i=1;
    @Override
    public void run() {
        while (i<=100){
            processData();
            TakeABreak.sleep();
        }
    }
    
    private synchronized void processData(){
        System.out.println("Number: "+i //Print out i
                                   +" Processed by: "
                                   +Thread.currentThread().getName());
        i++;//Explicity increment i
    }
}
