Double check size
to avoid ArrayIndexOutOfBoundsException
(#9609)
Motivation: Recycler$Stack.pop will occurs `ArrayIndexOutOfBoundsException` in some race cases, we should double check `size` even after `scavenge` called. Modifications: Double check `size` after `scavenge` Result: avoid ArrayIndexOutOfBoundsException in `pop`
This commit is contained in:
parent
92941cdcac
commit
3ef00eaa06
@ -511,6 +511,10 @@ public abstract class Recycler<T> {
|
||||
return null;
|
||||
}
|
||||
size = this.size;
|
||||
if (size <= 0) {
|
||||
// double check, avoid races
|
||||
return null;
|
||||
}
|
||||
}
|
||||
size --;
|
||||
DefaultHandle ret = elements[size];
|
||||
|
Loading…
Reference in New Issue
Block a user