• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java.util.Calendar

 
hariharan jayaprakash
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



I have tried to get the current time object, So i wanna to execute every minute to be noticed and then it should terminate the program for one minute.

Like "Page will be expired in 60 Seconds".. 59 58..... upto 0...
Then my code should terminate, How can i achieve this?...
 
Winston Gutkowski
Bartender
Pie
Posts: 10508
64
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hariharan jayaprakash wrote:I have tried to get the current time object, So i wanna to execute every minute to be noticed and then it should terminate the program for one minute.

Like "Page will be expired in 60 Seconds".. 59 58..... upto 0...
Then my code should terminate, How can i achieve this?...

Quite tricky to do with 100% certainty, but you should probably start by looking at Thread.sleep(). The java.util.Timer class may also be of use.

Winston
 
Rob Spoor
Sheriff
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd go for java.util.Timer or a ScheduledExecutorService (creating using the Executors utility class).

Also:
hariharan jayaprakash wrote:

You should compare against the constants:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic