aspose file tools*
The moose likes Java in General and the fly likes Timer help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Timer help" Watch "Timer help" New topic
Author

Timer help

sparsh khandelwal
Ranch Hand

Joined: Dec 20, 2010
Posts: 70

i believe that this program should be continue until CTRL +C
but not working in that fashion , please help
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3446
    
  12
sparsh khandelwal wrote:
i believe that this program should be continue until CTRL +C
but not working in that fashion , please help

I'm afraid you believe wrong. Read the Javadoc again for the schedule method that takes a TimerTask and a long as parameters.


Joanne
sparsh khandelwal
Ranch Hand

Joined: Dec 20, 2010
Posts: 70
thanks for your reply
this is the source of the program
timer task program
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3446
    
  12
sparsh khandelwal wrote:thanks for your reply
this is the source of the program
timer task program

We don't need to see the source. Your original post showed us the problem - you are assuming the schedule method you are calling does something different to what it actually does. To do what you want to do you need to call one of the other overloaded versions of that method.

I didn't actually look at the RoseIndia link. If it says that the source code you posted should repeatedly run the task, then it is wrong.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3446
    
  12
Joanne Neal wrote:
sparsh khandelwal wrote:
i believe that this program should be continue until CTRL +C
but not working in that fashion , please help

I'm afraid you believe wrong. Read the Javadoc again for the schedule method that takes a TimerTask and a long as parameters.

Actually I was slightly mistaken. This program will run until Ctrl-C is pressed (because the Timer is never cancelled). It just won't repeatedly print out a message every second as the comment in the code suggests it will.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Timer help