On Sat, 9 Oct 2021 17:08:50 GMT, XenoAmess <d...@openjdk.java.net> wrote:

> in extream situation, when doing this.skipBuffer = skipBuffer in Thread B, it 
> might make this.skipBuffer to a byte[6] in thread A, and thus cause a 
> IndexOutofBoundException in Thread A.

No, it won't. The later `skipBuffer` references are made to the local variable; 
so even though the `new byte[6]` may replace the cached `new byte[10]` skip 
buffer in instance field, in thread A, it is still using the old `new byte[10]` 
which is stored in the local variable/stack, and everything just proceeds fine 
(only shortcoming is that the 10-length skip buffer is wasted and recycled)

-------------

PR: https://git.openjdk.java.net/jdk/pull/5872

Reply via email to