Small improvements to nio native code (unix)
Alan Bateman
Alan.Bateman at oracle.com
Tue Aug 31 02:30:28 PDT 2010
Martin Buchholz wrote:
> Hi Alan,
>
> I'd like you to do a code review.
>
> Avoid problematic JNI *Critical functions.
> Fix rawtypes compile warnings.
> Make IOUtil native code more readable.
> Rename initPipe to makePipe.
> Rename "block" argument to "blocking" for consistency.
>
> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/IOUtil/
> <http://cr.openjdk.java.net/%7Emartin/webrevs/openjdk7/IOUtil/>
>
> Thanks,
>
> Martin
It makes sense to return the two file descriptors in a jlong rather than
using a JNI critical section (although they aren't as bad as they used
to be in that a thread requiring a GC because an allocation cannot be
satisfied will now stall rather than throw OOME).
Anyway, the changes look okay to me. I've created this bug:
6981145: (se) Eliminate JNI*Critical when creating pipes and other
cleanups
Minor nit but at line IOUtil.c L140 you've got "const char * msg" (space
on either side of the asterisk).
In passing, I see in Java_sun_nio_ch_IOUtil_makePipe doesn't close the
pipe in the highly unlikely event that the configureBlocking fails. It
might be good to fix that while you are there (if you don't mind of course).
-Alan.
More information about the nio-dev
mailing list