|
Quick Lists
|
|
Bug ID:
|
4291378
|
|
Votes
|
3
|
|
Synopsis
|
Termination of thread blocked carrying out I/O - deprecation of stop method
|
|
Category
|
java:classes_lang
|
|
Reported Against
|
kestrel-beta
|
|
Release Fixed
|
|
|
State
|
11-Closed,
Not Reproducible,
request for enhancement
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
4154947
|
|
Submit Date
|
15-NOV-1999
|
|
Description
|
java version "1.3beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3beta-O)
Java(TM) HotSpot Client VM (build 1.3beta-O, mixed mode)
There seems to be no way of stopping a thread that is blocking carrying out I/O
(for example connecting to a URL) - even by using interrupt, apart from calling
stop - which is now deprecated.
For example put the following in a thread run method and try to stop it:
URL url;
HttpURLConnection http;
int rcode = 0;
String rmesg = "";
String urlTxt = "http://www.a-bad-link.com";
url = new URL(urlTxt);
http = (HttpURLConnection)url.openConnection();
http.connect();
rmesg = http.getResponseMessage();
rcode = http.getResponseCode();
(Review ID: 97516)
======================================================================
|
|
Work Around
|
None - except by using stop.
======================================================================
|
|
Evaluation
|
It is my understanding that neither interrupt nor stop ever worked in this case. In fact, they work equally well for interrupting I/O (highly platform dependent). A much better way to interrupt a thread waiting on a socket (HttpURLConnection) is to close the socket.
There are I/O improvements in progress. Perhaps they will address this problem more directly.
xxxxx@xxxxx 1999-12-21
See the specification of the java.nio.channels.Channel interface.
-- xxxxx@xxxxx 2001/7/18
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |