I've got a request to create an analysis of running threads within a JVM to monitor for long running jobs. Is there any way to find the starting date/time of a Java thread? I have no problem getting the threads, but I cannot figure out any way to to find out how long the thread has been active or when it started. To get the threads, I am simply enumerating over the ThreadGroup.
Note that I have no control over the actual threads themselves, so I can't put in any time or property and log the start time myself. All I have it the actual thread itself and need to determine the data from that. I can find two methods on the thread -- "getThreadCpuTime()" and "getThreadUserTime()" but I'm not sure those are enough, since apparently the thread will occasionally invoke a sleep() method, and I'm afraid that the "sleep" time would not be included in either of these methods.
Is there any way to determine the start time for a thread? Or will either of the two time methods return how long a thread has been active?