This is the mail archive of the java-prs@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

java.io/204: Resource revocation (close) does not cancel PipedInputStream reader



>Number:         204
>Category:       java.io
>Synopsis:       Resource revocation (close) does not cancel PipedInputStream reader
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    tromey
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 15 21:40:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Jeff Sturm
>Release:        CVS
>Organization:
>Environment:
Any	
>Description:
Some time ago on java-dicuss we talked about I/O cancellation
via resource revocation vs. thread interruption.  Sun is
deprecating the latter technique it seems, and the former
may have to be used for portability.

In libgcj thread interruption generally works but is platform
dependent (e.g. socket reads will NOT be interruptable on
Win32).  I think it was informally decided that we should
support both techniques if possible.

I put together the attached test program to demonstrate that
a PipedInputStream does not return from read() when the stream
is closed.  The same goes for PipedReader.  JDK 1.1.x behaves
the same as libgcj in that regard; I haven't tried JDK 1.2.

Should we alter the stream classes to make their behavior
consistent regardless of compatibility with the JDK?
>How-To-Repeat:
Compile/run the attached program with gcj.  After about two seconds it will
return with:

Closing pipe input stream:
Interrupting pipe reader:
java.io.InterruptedIOException
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="PipeTest.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="PipeTest.java"

aW1wb3J0IGphdmEuaW8uUGlwZWRJbnB1dFN0cmVhbTsKaW1wb3J0IGphdmEuaW8uUGlwZWRPdXRw
dXRTdHJlYW07CgpwdWJsaWMgY2xhc3MgUGlwZVRlc3QgaW1wbGVtZW50cyBSdW5uYWJsZSB7CglU
aHJlYWQgbWFpbjsKCVBpcGVkSW5wdXRTdHJlYW0gaW47CglQaXBlZE91dHB1dFN0cmVhbSBvdXQ7
CgoJc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