• Post Reply Bookmark Topic Watch Topic
  • New Topic

Delaying Execution Of Java Program  RSS feed

 
Abiodun Adisa
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
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
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: 24217
38
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
 
Joanne Neal
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!