I have following classes for solving the producer consumer scenario.
Now i am passing the same socket client object to both my Producer and Consumer Threads. They further pass it to the SockClientProducer and SockClientConsumer Threads which use the output stream and the input stream respectively.
Now if socket exception occurs then i am supposed to reconnect and ensure my application does not go down.
My problem is that in this design the same socket connection is being used in two different threads. if a socket exception occurs then both the threads will throw the exception. Now where should i recover from the socket exception. in Producer
thread or Consumer thread or the code calling the Producer and Consumer threads. Do i need to change my design.
Please any ideas are welcome!