Zephyr Guo created HBASE-14490:
----------------------------------
Summary: [RpcServer] reuse buffer and more stricter code
Key: HBASE-14490
URL: https://issues.apache.org/jira/browse/HBASE-14490
Project: HBase
Issue Type: Improvement
Components: IPC/RPC
Reporter: Zephyr Guo
Assignee: Zephyr Guo
1.Reuse buffer to read request.
It's not necessary free data's buffer for each request.
2.There are hidden trouble in socket IO with non-blocking mode.
We just use *channel.read(byteBuffer)* to read data of
request(byteBuffer.limit=dataLength).We need *dataLength* bytes but read maybe
not fill the *byteBuffer*.
The link is the *read(byteBuffer)* method
describe:http://docs.oracle.com/javase/7/docs/api/java/nio/channels/SocketChannel.html#read(java.nio.ByteBuffer)
I write a sample to test it(Test.java).
3.*channelIO()* method return value
More stricter return value.
So I rewrite *channelIO*.It can work well with non-blocking and back small
IO(size<NIO_BUFFER_LIMIT) or large.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)