Java Timers





7
Date Submitted Tue. Feb. 21st, 2006 11:47 AM
Revision 1 of 1
Coder mattrmiller
Tags Java | Timer
Comments 1 comments
A simple implementation of a Java timer. Executes timer task every second.


import java.util.Timer;
import java.util.TimerTask;

public final class TestTimer extends TimerTask
{

        /**
        * Main function
        */

        public static void main ( String[] arguments )
        {
                Timer cTimer  = new Timer();
                cTimer.scheduleAtFixedRate(new TestTimer(), 0, 1000);
        }

        /**
        * Implements TimerTask's abstract run method.
        */

        public void run()
        {
                System.out.println("Hello...");
        }
}

 

Matthew R. Miller

www.bluecreststudios.com
=================
Matthew R. Miller

http://bluecreststudios.com
http://www.codeandcoffee.com

Comments

Comments Quartz - Java Scheduling
Thu. Sep. 21st, 2006 9:40 PM    Beginner java_junkie

Voting