Hi,
I am facing a problem with a stopping thread which is in a synchronized block. I am using TCP socket. The problem is that I am waiting on a DataInputStream
object and I want to create a new socket again but it doesn't allow me to do because of the synchronized block.
I have tried with Thread.interrupted()
. I cannot avoid the synchronized block. Is there any other way to do the same?
dis = new DataInputStream(ReadWriteData.kkSocket.getInputStream());
int i = -1;
String aval = ""; //new String();
char c = (char)dis.read();
It is getting blocked on dis.read()
.
What I should do for escaping the dis.read
when I want to create a new socket?
Thanks in advance.