Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2005

Tip: Looking for answers? Try searching our database.

timertask

Thread view: 
Shea Martin - 06 Apr 2005 23:41 GMT
Is it just me, or is the documentation for java.util.TimerTask
(http://java.sun.com/j2se/1.5.0/docs/api/index.html?overview-summary.html) a
little scant?

How do set the interval?  How do schedule when it runs?  I read examples on
web that show using schedule()?  Where is the spec for the schedule method
in the docs?

In the past I have just used a normal thread, then did a sleep(MY_INTERVAL)
at the bottom of the run() method.  So it looks like TimerTask may be
exactly what I want.

If I specify an interval for my task to run at, say 5 seconds, will it run
the task every 5 seconds, or 5 seconds between runs.
i.e., What happens if my run() takes 8 seconds, but the timerTask is
scheduled at a 5 second interval?

Thanks,

~S
Ryan Stewart - 07 Apr 2005 12:51 GMT
> Is it just me, or is the documentation for java.util.TimerTask
> (http://java.sun.com/j2se/1.5.0/docs/api/index.html?overview-summary.html) a
[quoted text clipped - 12 lines]
> i.e., What happens if my run() takes 8 seconds, but the timerTask is scheduled
> at a 5 second interval?

Read the java.util.Timer docs instead.
Shea Martin - 07 Apr 2005 16:23 GMT
>>Is it just me, or is the documentation for java.util.TimerTask
>>(http://java.sun.com/j2se/1.5.0/docs/api/index.html?overview-summary.html) a
>>little scant?
>
> Read the java.util.Timer docs instead.

Thanks.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.