01: /**
02:    An action that repeatedly prints a greeting.
03: */
04: public class GreetingProducer implements Runnable
05: {
06:    /**
07:       Constructs the producer object.
08:       @param aGreeting the greeting to display
09:    */
10:    public GreetingProducer(String aGreeting)
11:    {
12:       greeting = aGreeting;
13:    }
14: 
15:    public void run()
16:    {
17:       try 
18:       {
19:          for (int i = 1; i <= REPETITIONS; i++)
20:          {
21:             System.out.println(i + ": " + greeting);
22:             Thread.sleep(DELAY);                     
23:          }
24:       }
25:       catch (InterruptedException exception)
26:       {
27:       }
28:    }
29: 
30:    private String greeting;
31: 
32:    private static final int REPETITIONS = 10;
33:    private static final int DELAY = 100;
34: }