HBASE-4236 Don't lock the stream while serializing the response (Benoit Sigoure)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1160370 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2011-08-22 18:45:20 +00:00
parent 58dfa28fef
commit 8cc16ab55f
2 changed files with 14 additions and 14 deletions

View File

@ -388,6 +388,7 @@ Release 0.91.0 - Unreleased
HBASE-4229 Replace Jettison JSON encoding with Jackson in HLogPrettyPrinter
(Riley Patterson)
HBASE-4230 Compaction threads need names
HBASE-4236 Don't lock the stream while serializing the response (Benoit Sigoure)
TASKS
HBASE-3559 Move report of split to master OFF the heartbeat channel

View File

@ -514,23 +514,22 @@ public class HBaseClient {
return;
}
DataOutputBuffer d=null;
// For serializing the data to be written.
final DataOutputBuffer d = new DataOutputBuffer();
try {
if (LOG.isDebugEnabled())
LOG.debug(getName() + " sending #" + call.id);
d.writeInt(0xdeadbeef); // placeholder for data length
d.writeInt(call.id);
call.param.write(d);
byte[] data = d.getData();
int dataLength = d.getLength();
// fill in the placeholder
Bytes.putInt(data, 0, dataLength - 4);
//noinspection SynchronizeOnNonFinalField
synchronized (this.out) { // FindBugs IS2_INCONSISTENT_SYNC
if (LOG.isDebugEnabled())
LOG.debug(getName() + " sending #" + call.id);
//for serializing the
//data to be written
d = new DataOutputBuffer();
d.writeInt(0xdeadbeef); // placeholder for data length
d.writeInt(call.id);
call.param.write(d);
byte[] data = d.getData();
int dataLength = d.getLength();
// fill in the placeholder
Bytes.putInt(data, 0, dataLength - 4);
out.write(data, 0, dataLength);
out.flush();
}