• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Java.util.Calendar

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?...
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22729
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
rubbery bacon. rubbery tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic