Ivy
Ivy

Reputation: 511

how to get the currently running thread in ExecutorService

I got a pool of threads using ExecutorService, this executorService will execute the runnable class I implemented, and now I'd like to get the currently running thread in this pool, how? Please help, thanks.

Thread currThread  = Thread.currentThread();

Will this get the current running thread in the pool?

Upvotes: 0

Views: 226

Answers (1)

Malatesh
Malatesh

Reputation: 1954

Thread currThread  = Thread.currentThread()

write the above code in your part of code which is shared between pool of threads.

Upvotes: 1

Related Questions