public void sendParam(Call call) {
if (shouldCloseConnection.get()) {
return;
}
DataOutputSerializer d = null;
try {
synchronized (this.out) {
// for serializing the
// data to be written
d = new DataOutputSerializer(64);
// First, write call id to buffer d
d.writeInt(call.id);
// Then write RPC data (the actual call) to buffer d
call.param.write(d);
ByteBuffer wrapper = d.wrapAsByteBuffer();
byte[] data = wrapper.array();
int dataLength = wrapper.limit();
out.writeInt(dataLength); // first put the data length
out.write(data, 0, dataLength);// write the data
out.flush();