Friday, October 16, 2009

Overview




















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

Java Thread Programming
Paul
Hyde






size=1>  size=2>Copyright � 1999 Sams
Publishing




















size=5>Chapter 15: size=5>Breaking Out of a Blocked I/O State












size=4>Overview












size=2>Unfortunately, as of Java 1.2, most blocking I/O statements
in the JDK still ignore interrupt requests. This presents a problem
when you want to have a thread stop waiting on the I/O operation and
do something else—typically to clean up and die. This problem
generally arises in situations where data is read from a stream
intermittently. A common case is a conversation between a client and
server over a socket’s streams. Typically in this scenario, a thread
blocks for long periods of time on a stream waiting for another
request to come across the line.












size=2>In this chapter, I’ll present some techniques that you can
use to get a thread to break out of a blocked I/O state. I’ll begin
by demonstrating the blocking problem with an example.












valign="top" bgcolor="#FFFFFF">

Toc



No comments:

Post a Comment