return rsp;
}
public void writeComplete(int rc, long ledgerId, long entryId, InetSocketAddress addr, Object ctx) {
TimedCnxn tcnxn = (TimedCnxn) ctx;
Cnxn src = tcnxn.cnxn;
long startTime = tcnxn.time;
ByteBuffer bb = ByteBuffer.allocate(24);
bb.putInt(new PacketHeader(BookieProtocol.CURRENT_PROTOCOL_VERSION,
BookieProtocol.ADDENTRY, (short)0).toInt());
bb.putInt(rc);
bb.putLong(ledgerId);
bb.putLong(entryId);
bb.flip();
if (LOG.isTraceEnabled()) {
LOG.trace("Add entry rc = " + rc + " for " + entryId + "@" + ledgerId);
}
src.sendResponse(new ByteBuffer[] { bb });
if (isStatsEnabled) {
// compute the latency
if (0 == rc) {
// for add operations, we compute latency in writeComplete callbacks.
long elapsedTime = System.currentTimeMillis() - startTime;