thetumbled commented on PR #18390:
URL: https://github.com/apache/pulsar/pull/18390#issuecomment-1310320076
> > the local variable table will not be updated.
>
> @thetumbled It's not true. `table` variable is a reference not a copy, so
its length may change.
In the `rehash` method, the member `this.table` of `Section` will be
reallocated a new long[] array, which is different from old table member.
For example:
```
public static void main(String[] args) {
int[] table = new int[]{1, 2};
int[] localTable = table;
System.out.println(localTable.length);
// rehash table to new array.
table = new int[]{3};
System.out.println(localTable.length);
}
```
the result will be following:
<img width="104" alt="image"
src="https://user-images.githubusercontent.com/52550727/201110781-e6f6af4e-7196-45db-89c3-0a998f007091.png">
--
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]