• Post Reply Bookmark Topic Watch Topic
  • New Topic

Delaying Execution Of Java Program  RSS feed

 
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this Java Program and I have the requirement which states that whenever the Program is Started it should wait for like 60 minutes before printing out a message


eg

Please what code can i insert that would delay the application for 60 minutes
 
author and iconoclast
Sheriff
Posts: 24219
40
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thread.sleep(60*60*1000) ?
 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ernest Friedman-Hill:
Thread.sleep(60*60*1000) ?



Any other Option
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24219
40
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends what your requirements are, exactly. Is the program supposed to be doing something during those 60 minutes?
 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ernest Friedman-Hill:
Depends what your requirements are, exactly. Is the program supposed to be doing something during those 60 minutes?


After 60 minutes, The program would invoke a Web service Application after 60 minutes
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Couldn't you just wait 60 minutes before starting the program

Or you could take a look at the Timer and TimerTask classes.
 
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!