stop thread that does not get interrupted
Posted
by prmatta
on Stack Overflow
See other posts from Stack Overflow
or by prmatta
Published on 2010-06-15T16:16:47Z
Indexed on
2010/06/15
16:22 UTC
Read the original article
Hit count: 264
I have a thread that sits and reads objects off of an ObjectInputStream:
public void run() {
try {
ois = new ObjectInputStream(clientSocket.getInputStream());
Object o;
while ((o = ois.readObject()) != null) {
//do something with object
}
} catch (Exception ex) {
//Log exception
}
}
readObject does not throw InterruptedException and as far as I can tell, no exception is thrown when this thread is interrupted. How do I stop this thread?
© Stack Overflow or respective owner