• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to get the elapsed Thread wait time?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

If my thread sleeps for 100 seconds.How can i get the details of time elapsed at a given point of time?
Is there any java API to get it?

Edward
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is going to be observing the sleeping Thread?

You can use java.lang.System.currentTimeMillis() to set a long variable timestamp just before starting to sleep, but who will be looking at that?

Is this just a matter of curiosity or do you really have a need?

Bill
 
eddy abraham
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bill thanks for reply..

I need it in some of my work . i need to get the elapsed time and i have to set some conditions based on the elapsed time , so that the resumed thread has to perform some additional tasks.I am able to achive it using "java.lang.System.currentTimeMillis() " .. just want to know weather there is any method that will return it

Thanks

Edward
 
reply
    Bookmark Topic Watch Topic
  • New Topic