Thread.interrupt()

Miles Sabin msabin@cromwellmedia.co.uk
Tue Mar 14 07:47:00 GMT 2000


Jeff Sturm wrote,
> [snip: resource revocation as an alternative to interrupt()]
> That sounds like trading one set of underspecified behavior 
> for another.  I haven't tested myself this on any range of 
> platforms.

Perhaps, yes. However, I would expect any robust implementation
of a stream class to respond in the Right Way to closure.

> Some stream classes are virtual, like PipedReader.  It blocks 
> on object.wait().   Waking it up with an interrupt would be 
> easy enough. It can be made to respond to a close() as well.

It is in Sun's implementation (all the recent one's anyhow).
The alternative would be to leave either or both of the
producer/consumer threads permanently blocked ... if that
happened I'd call it a bug, independently of any issues around
interruption.

Cheers,


Miles

-- 
Miles Sabin                       Cromwell Media
Internet Systems Architect        5/6 Glenthorne Mews
+44 (0)20 8817 4030               London, W6 0LJ, England
msabin@cromwellmedia.com          http://www.cromwellmedia.com/



More information about the Java mailing list