lordcheng10 edited a comment on pull request #3061:
URL: https://github.com/apache/bookkeeper/pull/3061#issuecomment-1046045655
1.check if the parameter is legal;
2.fix the shrinkage condition:
①newCapacity > size: in order to prevent the infinite loop of rehash,
newCapacity should be larger than the currently used size;
②newCapacity > resizeThresholdUp: in order to prevent continuous expansion
and contraction, newCapacity should be greater than the expansion threshold;
`
if (autoShrink && size < resizeThresholdBelow && resizeThresholdUp >
resizeThresholdBelow) {
try {
// shrink the hashmap
rehash((int) Math.max(resizeThresholdUp, capacity /
shrinkFactor));
} finally {
unlockWrite(stamp);
}
}
`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]