Originally posted by dharmesh baveja:
[...] In the run() method some URL Connection is opened and inputStream is fetched . There is no problem regarding inconsistent state of objects due to terminating Thread during execution of run() or I/O (Thread.stop() is not at all unsafe for this situation).
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
What if a thread doesn't respond to Thread.interrupt?
In some cases, you can use application specific tricks. For example, if a thread is waiting on a known socket, you can close the socket to cause the thread to return immediately. Unfortunately, there really isn't any technique that works in general. It should be noted that in all situations where a waiting thread doesn't respond to Thread.interrupt, it wouldn't respond to Thread.stop either. Such cases include deliberate denial-of-service attacks, and I/O operations for which thread.stop and thread.interrupt do not work properly.
Originally posted by dharmesh baveja:
Secondly , as i think Thread.Interrup() is to awake sleeping threads.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Senior Software Engineer, IBM
author of: Practical Java
Consider Paul's rocket mass heater. |