From the comment:
Is there anything else you can do to restart the stream?
You can use ThreadPoolExecutor , which will allow you to perform tasks and let the service assign a thread to the task. When the task is completed, the thread is idle until it receives the next task.
So, you do not restart the thread, but you will repeat / resume the task.
Thomas
source share