HADOOP-8071. Avoid an extra packet in client code when nagling is disabled. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1244190 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
26d098b855
commit
6fe9bd2e68
|
@ -14,6 +14,8 @@ Release 0.23.2 - UNRELEASED
|
|||
(szetszwo)
|
||||
|
||||
OPTIMIZATIONS
|
||||
HADOOP-8071. Avoid an extra packet in client code when nagling is
|
||||
disabled. (todd)
|
||||
|
||||
BUG FIXES
|
||||
|
||||
|
|
|
@ -788,12 +788,16 @@ public class Client {
|
|||
//for serializing the
|
||||
//data to be written
|
||||
d = new DataOutputBuffer();
|
||||
d.writeInt(0); // placeholder for data length
|
||||
d.writeInt(call.id);
|
||||
call.param.write(d);
|
||||
byte[] data = d.getData();
|
||||
int dataLength = d.getLength();
|
||||
out.writeInt(dataLength); //first put the data length
|
||||
out.write(data, 0, dataLength);//write the data
|
||||
int dataLength = d.getLength() - 4;
|
||||
data[0] = (byte)((dataLength >>> 24) & 0xff);
|
||||
data[1] = (byte)((dataLength >>> 16) & 0xff);
|
||||
data[2] = (byte)((dataLength >>> 8) & 0xff);
|
||||
data[3] = (byte)(dataLength & 0xff);
|
||||
out.write(data, 0, dataLength + 4);//write the data
|
||||
out.flush();
|
||||
}
|
||||
} catch(IOException e) {
|
||||
|
|
Loading…
Reference in New Issue