Hello, I analyzed this thread and could not find why Archie's suggestion #3 was rejected. Why we should invent interrupt notification mechanism while Thread has method interrupted() ?. This method is from public API, and some interruptable operation can call it to get know if blocked thread was interrupted or not. And if the thread was interrupted, this operation acts as specified: "...and the thread will receive a ClosedByInterruptException"
Andrew Zhang wrote Oh... Got it, thanks, Archie. One more question: Where does these code locate? In begin/end method or main body between begin/end?
This code should be located in blocking operation (read() for example)
Not only Selector, SocketChannel, ServerSocketChannel but also any class who extends AbstractInterruptibleChannel are interruptible channel. Any interruptible channel could use begin/end to mark a blocking I/O operation.
I doubt that just calling of this methods will made blocking operations interruptable. I.e. we should have interruption support in [interruptable] blocking operation anyway. In the case of implementation of setInterruptAction (as Paulex proposed) we can fall into the problems with managing of such actions (multiple consequent begin()s could be an example). Sorry if I missed something. Thank You, Alexander --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]