How to uniquely identify a stream in Java?

Is there a way, in Java, to uniquely identify a thread? Using only Thread.getCurrent().getId() not enough, as the thread may die, and the next one may receive its identifier. These are not the same streams for me, so I need a way to identify them.

A thread creation timestamp would be helpful if I could get it.

+4
source share
1 answer

What happened using == ? Or, if you need the actual number, System.identityHashCode is probably a safe bet.

+7
source

All Articles