Results 1 to 3 of 3
- 08-03-2012, 08:33 AM #1
Member
- Join Date
- Aug 2012
- Posts
- 1
- Rep Power
- 0
how to stop a timer at particular time
i have one problem with java scheduler,my actual need is i have to start my process at particular time, and i will stop at certain time ,i can start my process at specific time but i can't stop my process at certain time ,how to specify the process how long to run in scheduler,(here i will not put while ) any one have suggestion for that.
Java Code:import java.util.Timer; import java.util.TimerTask; import java.text.SimpleDateFormat; import java.util.*; public class Timer { public static void main(String[] args) throws Exception { Date timeToRun = new Date(System.currentTimeMillis()); System.out.println(timeToRun); Timer timer1 = new Timer(); timer1.schedule(new TimerTask() { public void run() { //here i call another method } } }, timeToRun);//her i specify my start time } }
- 08-03-2012, 09:41 AM #2
Member
- Join Date
- Aug 2012
- Posts
- 2
- Rep Power
- 0
Re: how to stop a timer at particular time
Please visit this url
Java Practices -> Schedule periodic tasks
- 08-03-2012, 10:42 AM #3
Similar Threads
-
Help with a stop and continue button with a timer plz. JAVA
By elbert.dewet@yahoo.com in forum AWT / SwingReplies: 1Last Post: 06-11-2012, 07:46 PM -
timer clock(buzzer) How get time
By derata in forum Sun Java Wireless ToolkitReplies: 4Last Post: 05-06-2012, 07:36 PM -
Stop a timer in other class
By warchieflll in forum Advanced JavaReplies: 15Last Post: 02-02-2011, 08:13 PM -
[SOLVED] Stop multithreads at same time
By Niveditha in forum Threads and SynchronizationReplies: 3Last Post: 02-25-2009, 04:51 PM -
Stop multithreads at same time
By Niveditha in forum Threads and SynchronizationReplies: 3Last Post: 02-25-2009, 02:42 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks