Hi all,

I have observed numerous hardcoded byte calculation expressions, such as `1024L 
* 1024L * 1`: 
https://github.com/apache/pulsar/blob/d33cc20761b97d103d52ce7e24638edcd43a2a1e/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java#L854
 for byte calculations.

And the `SizeUnit`enum 
:https://github.com/apache/pulsar/blob/master/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/SizeUnit.java
 in the pulsar-client-api module offers a more readable alternative; we can use 
SizeUnit.MEGA_BYTES.toBytes(1) and similar methods.

I propose refactoring similar patterns in several locations to utilize SizeUnit 
methods for improved clarity and consistency.

Thanks,
ZhengKe Zhou

Reply via email to