Schedule a Thread

Hi,How do I schedule a thread to run every two seconds?Thanks
[82 byte] By [java_swing_dudea] at [2007-11-27 9:36:01]
# 1
Have you tried java.util.Timer as suggested in your other thread? http://forum.java.sun.com/thread.jspa?threadID=5191283
pbrockway2a at 2007-7-12 23:04:09 > top of Java-index,Java Essentials,Java Programming...
# 2
Does this create a thread or do I run my thread from the timer?What if I want to run more than one thread to read the values from a HashMap and perform calculations on them concurrently?Can u give me an example.
java_swing_dudea at 2007-7-12 23:04:09 > top of Java-index,Java Essentials,Java Programming...
# 3

You give the timer some tasks, it creates the threads (and cleans them up etc). One thread is used per timer. Have you read the API documentation - both questions are addressed in the first couple of paragraphs?

Also check out the Tech Tip (which has teh coveted codez) here: http://java.sun.com/developer/TechTips/2000/tt0530.html

pbrockway2a at 2007-7-12 23:04:09 > top of Java-index,Java Essentials,Java Programming...