The reason why HashMap multithreads send out life and death loops

This article is a learning record of Vaccine: Java HashMap’s endless loop, welcome to discuss ~
Suppose the state of a cylinder to be expanded is as follows:
1->; 2-> Null
1 for the current thread to insert a new element of an array of e: 1 and the next element next:
when thread 2 completed the expansion, the pointer to the current status to 2 – & gt; 1-> NULL
Thread 1 continues:
rst (e:1,next:2)
n>arrel :1 ->; null

e=next=2;
next=e1.next=1;

> (e:2,next:1)
> 1-> null

e=next=1;
next=e1.next=null;

(e:1,next:null)
new barrel :1 ->; 2-> 1 is just 1 lt; -> 2

e=next=null;

cpu100%
7 using head insert, 1.8 using tail insert for capacity expansion.
1.7 using head insert, 1.8 using tail insert for capacity expansion.

Read More: