Name: sgC58550 Date: 03/14/97
In some cases, when you call the ObjectInputStream constructor
on a PipedInputStream, the Java application will freeze. There
are no error messages; the system simply hangs.
The problem specifically occurs when you are initializing a
thread with an externally visible ObjectInputStream (ie. A
serialization daemon that reads binhex-encoded bytes from an
external process and converts them back so the application
can use object serialization transparently).
For example, the following code will compile correctly, but
the application will hang when the thread constructor is called:
class serializeDaemon extends Thread {
public ObjectInputStream serializeStream;
public PipedInputStream inPipe;
private BufferedOutputStream processedData;
public serializeDaemon(String name) {
super(name);
try {
inPipe = new PipedInputStream();
// Used by thread to pass on processed data.
processedData = new BufferedOutputStream(
new PipedOutputStream(inPipe));
// Application hangs here.
serializeStream = new ObjectInputStream(inPipe);
} catch (Exception e) {
System.out.println(e);
}
}
public void run() { etc...
company - Cornell University , email - ###@###.###
======================================================================