RobertIndie commented on PR #16256: URL: https://github.com/apache/pulsar/pull/16256#issuecomment-1168201771
> In addition, adding initial values to a recyclable class is dangerous. For a recyclable class, we should make constructors private and only expose some factory methods and set the value in these factory methods. > > The reason is that if the object was reused from the pool, the initial value should be what was set in `recycle()` method. > Before this PR, there is already an inconsistent issue in the OpSendMsg. The value of the OpSendMsg just initialized is not the same as the OpSendMsg just being recycled. This PR is to fix this inconsistency. I was wondering if we could have the recyle method call some kind of initialization method so we don't need to maintain the same initialization value in two places. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org