001    package javax.realtime;
002    
003    public class QuantaThread extends RealtimeThread
004    {
005      public static int timerFlag = 0;
006      public static boolean done = false;
007    
008      public QuantaThread()
009      {
010          super();
011          System.out.println("Constructing QuantaThread");
012          start();
013          System.out.println("Done starting Quanta Thread()");
014      }
015    
016      public void run()
017      {
018        try { 
019          while(!done)
020            {
021              sleep(1000); 
022              System.out.println("Time: "+System.currentTimeMillis());
023              timerFlag = 1;
024            }
025        } catch(InterruptedException ie) 
026          { 
027            System.out.println("Thread interrupted");
028          }
029      }
030    
031      public static void flagHandler()
032      {
033        System.out.println("Java sees timerFlag set.");
034    
035        timerFlag = 0;
036      }
037    }