Results 1 to 3 of 3
  1. #1
    Mr.cool is offline Member
    Join Date
    Aug 2012
    Posts
    1
    Rep Power
    0

    Default 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
        				  
        			   
        		    }
        }

  2. #2
    anandkesari01 is offline Member
    Join Date
    Aug 2012
    Posts
    2
    Rep Power
    0

    Default Re: how to stop a timer at particular time


  3. #3
    DarrylBurke's Avatar
    DarrylBurke is online now Moderator
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    9,936
    Rep Power
    16

    Default Re: how to stop a timer at particular time

    Quote Originally Posted by anandkesari01 View Post
    Please visit this url
    I don't see anything in that page that addresses the question asked here. Are you astroturfing?

    db
    Why do they call it rush hour when nothing moves? - Robin Williams

Similar Threads

  1. Help with a stop and continue button with a timer plz. JAVA
    By elbert.dewet@yahoo.com in forum AWT / Swing
    Replies: 1
    Last Post: 06-11-2012, 07:46 PM
  2. timer clock(buzzer) How get time
    By derata in forum Sun Java Wireless Toolkit
    Replies: 4
    Last Post: 05-06-2012, 07:36 PM
  3. Stop a timer in other class
    By warchieflll in forum Advanced Java
    Replies: 15
    Last Post: 02-02-2011, 08:13 PM
  4. [SOLVED] Stop multithreads at same time
    By Niveditha in forum Threads and Synchronization
    Replies: 3
    Last Post: 02-25-2009, 04:51 PM
  5. Stop multithreads at same time
    By Niveditha in forum Threads and Synchronization
    Replies: 3
    Last Post: 02-25-2009, 02:42 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •