Thread stopping in synchronized block
<p>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 <code>DataInputStream</code> object and I want to create a new socket again but it doesn't allow me to do because of the synchronized block.</p>

<p>I have tried with <code>Thread.interrupted()</code>. I cannot avoid the synchronized block.  Is there any other way to do the same?</p>

<pre><code>dis = new DataInputStream(ReadWriteData.kkSocket.getInputStream());
int i = -1;
String aval = ""; //new String();
char c = (char)dis.read();
</code></pre>

<p>It is getting blocked on <code>dis.read()</code>.</p>

<p>What I should do for escaping the <code>dis.read</code> when I want to create a new socket? </p>

<p>Thanks in advance.</p>
