A Generic Thread Pool: ThreadPool

Chapter 15 - Breaking Out of a Blocked I/O State

Java Thread Programming
Paul Hyde
  Copyright 1999 Sams Publishing

Summary
Blocked I/O statements can be troublesome to deal with, but this chapter offered a few techniques to avoid this difficulty. A blocked read() on an InputStream ignores interrupt() and stop() , but generally will throw an exception if its stream is closed by another thread. A blocked accept() on a ServerSocket also ignores interrupts, but will throw an exception if the ServerSocket is closed by another thread.
ThreadedInputStream and BufferedThreadedInputStream provide a mechanism that allows a blocked read() to be interrupted and throw an InterruptedIOException . Although this technique comes with the overhead of another thread, it can be very useful by providing interruptible I/O.

Toc


Java Thread Programming
Java Thread Programming
ISBN: 0672315858
EAN: 2147483647
Year: 2005
Pages: 149
Authors: Paul Hyde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net