check if a thread in a function is running in java code example Example: java check if thread is running Thread.isAlive()