Re: Socket InputStream.available may return a positive value after shutdown

2011-02-17 Thread Jing LV

于 2011-1-26 20:32, Alan Bateman 写道:

Jing LV wrote:

Hello,

I am using java.net.Socket and find an strange behaviour. If Socket
inputstream is shutdown, and there was still some data remaining, its
available() method may still return a positive value. I checked with the
java spec, and the document of Socket.shutdownInput() said:
"Places the input stream for this socket at "end of stream". Any data
sent to the input stream side of the socket is acknowledged and then
silently discarded.
If you read from a socket input stream after invoking shutdownInput() on
the socket, the stream will return EOF. "
What's more, as I check inputStream.read(), it return a EOF, So I guess
it would not be correct if available return a positive value.

I agree this needs to be looked at and I've created a bug to track it:

7014860: Socket.getInputStream().available() not clear for case that 
connection is shutdown for reading


(should be available on bugs.sun.com within 24h).

As it stands the behavior is highly platform specific. Solaris's 
ioctl(FIONREAD) does return 0 when the connection has been shutdown 
for reading. Linux continues to return the number of bytes in the 
socket buffer, as does Windows. There may be alternative SocketImpls 
that do something different. Minimally, Socket#getInputStream and 
Socket#shutdownInput should be clarified to make it clear what the 
expected behavior is, even if is platform specific.


-Alan
Thanks Alan! I try to follow this issue but has no luck on bugs.sun.com 
with the number 7014860. Am I miss something?


--
Best Regards,
Jimmy, Jing LV




Re: Socket InputStream.available may return a positive value after shutdown

2011-02-17 Thread Alan Bateman

Jing LV wrote:
Thanks Alan! I try to follow this issue but has no luck on 
bugs.sun.com with the number 7014860. Am I miss something?


I suspect there is a problem on bugs.sun.com as it doesn't seem to be 
showing any bugs. I noticed a "maintenance in progress" (or a message to 
that effect )a few days ago so maybe something is broken. Let me see if 
I can find out.


-Alan.


hg: jdk7/tl/jdk: 7017901: OOME in java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java

2011-02-17 Thread chris . hegarty
Changeset: 15ef6cf616d6
Author:chegar
Date:  2011-02-17 09:56 +
URL:   http://hg.openjdk.java.net/jdk7/tl/jdk/rev/15ef6cf616d6

7017901: OOME in 
java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java
Summary: Unbounded queues should be disabled in the test
Reviewed-by: alanb

! test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java



hg: jdk7/tl/jdk: 2 new changesets

2011-02-17 Thread alan . bateman
Changeset: 302877469037
Author:alanb
Date:  2011-02-17 20:50 +
URL:   http://hg.openjdk.java.net/jdk7/tl/jdk/rev/302877469037

6526860: (fc) FileChannel.position returns 0 when FileOutputStream opened in 
append mode
Reviewed-by: forax

! src/share/classes/sun/nio/ch/FileChannelImpl.java
! src/solaris/classes/sun/nio/fs/UnixChannelFactory.java
! test/java/nio/channels/FileChannel/Position.java

Changeset: a5861eb81f3c
Author:alanb
Date:  2011-02-17 20:53 +
URL:   http://hg.openjdk.java.net/jdk7/tl/jdk/rev/a5861eb81f3c

Merge




hg: jdk7/tl/jdk: 7018459: javax.script code comments have issues with HTML4 validation and Accessibility compliance

2011-02-17 Thread sundararajan . a
Changeset: dd143033cef1
Author:sundar
Date:  2011-02-18 12:07 +0530
URL:   http://hg.openjdk.java.net/jdk7/tl/jdk/rev/dd143033cef1

7018459: javax.script code comments have issues with HTML4 validation and 
Accessibility compliance
Reviewed-by: jjh

! src/share/classes/javax/script/ScriptEngineFactory.java