I have a code similar to this which is inside run() method of a Runnable and multiple instances of that Runnable get launched,
do{
try{
String contractNum=contractNums.take();
}catch(InterruptedException e){
logger.error(e.getMessage(), e);
}
}while(!("*".equals(contractNum)));
Where contractNums is a BlockingQueue<String> shared by multiple threads. There are separate Runnables putting elements to this queue.
I am not sure about next steps after catching InterruptedException, should I terminate this thread by re throwing a RuntimeException ( so my while loop terminates ) or try to take next element from contractNum queue again and ignoring InterruptedException?
I am not sure if InterruptedException to be treated as a fatal condition for thread to terminate or keep it in while loop.
Please suggest.