harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [jira] Created: (HARMONY-6328) [classlib][nio] optimize SocketChannel.write(ByteBuffer[], int, int) by writev
Date Mon, 14 Sep 2009 15:55:50 GMT
On 07/Sep/2009 09:33, Regis wrote:
> I managed to implement in this way and submit a patch to JIRA.
> 
> I tried to pass a object array, if it's direct buffer, fill the array
> element with buffer directly (heap byte buffer without an array will be
> copied to direct buffer first), otherwise, pass byte array. Because we
> still need to know the offset of arrays, so I have to pass it to native
> code.

Thanks Regis.

Looking at the patch "HARMONY-6328.v3.diff",

(1) This test is checking it is an instance of java.nio.ByteBuffer, but
it should be checking for instances of java.nio.DirectByteBuffer, right?

isDirectBuffer = (*env)->IsInstanceOf(env, buffer, byteBufferClass);

(2) Not sure if any JNI implementations will care, but AIUI you only
should call ReleaseByteArrayElements if you got a copy of the array
(i.e. as indicated by the GetByteArrayElements).


I didn't study the SocketChannelImpl too closely, but it looks better
now :-)  If you agree with (at leat) (1) above then we should apply the
patch and do some comparisons!

Regards,
Tim

Mime
View raw message