@@ -881,6 +1047,30 @@ public class ProducerImpl extends ProducerBase implements TimerTask {
}
}
/**
* Casts input cmd to {@link DoubleByteBuf}
*
* Incase if leak-detection level is enabled: pulsar instruments {@link DoubleByteBuf} into LeakAwareByteBuf (type of {@link io.netty.buffer.WrappedByteBuf})
* So, this method casts input cmd to {@link DoubleByteBuf} else retrieves it from LeakAwareByteBuf.
*
* @param cmd
* @return DoubleByteBuf or null in case failed to cast input {@link ByteBuf}
*/
privateDoubleByteBufgetDoubleByteBuf(ByteBufcmd){
DoubleByteBufmsg=null;
if(cmdinstanceofDoubleByteBuf){
msg=(DoubleByteBuf)cmd;
}else{
try{
msg=(DoubleByteBuf)cmd.unwrap();
}catch(Exceptione){
log.error("[{}] Failed while casting {} into DoubleByteBuf",producerName,cmd.getClass().getName(),