• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get the elapsed Thread wait time?

 
eddy abraham
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!