Puas yog concurrenthashmap muab xov zoo?

Cov txheej txheem:

Puas yog concurrenthashmap muab xov zoo?
Puas yog concurrenthashmap muab xov zoo?
Anonim

Cov ntsiab lus tseem ceeb ntawm ConcurrentHashMap: ConcurrentHashMap chav kawm yog xov-kev nyab xeeb piv txwv li ntau cov xov tuaj yeem ua haujlwm ntawm ib qho khoom yam tsis muaj teeb meem. … Hauv ConcurrentHashMap, Lub Hom Phiaj tau muab faib ua ntau ntu raws li qib concurrency.

Puas muab xov-kev nyab xeeb?

A MessageService khoom yog qhov hloov pauv tau zoo vim nws lub xeev tsis tuaj yeem hloov pauv tom qab nws tsim. Yog li no, nws yog xov-kev nyab xeeb. Ntxiv mus, yog tias MessageService tau hloov pauv tau tiag tiag, tab sis ntau cov xov tsuas muaj kev nyeem ntawv nkaus xwb, nws tseem muaj kev nyab xeeb thiab zoo.

Is ConcurrentHashMap loj xov-safe?

Class ConcurrentHashMap Lub rooj hash txhawb nqa tag nrho cov txiaj ntsig ntawm kev rov qab thiab kev cia siab rau qhov sib xws rau kev hloov tshiab. … Txawm li cas los xij, txawm tias txhua txoj haujlwm yog xov-kev nyab xeeb, kev ua haujlwm rov qab tsis suav nrog kev xauv, thiab tsis muaj kev txhawb nqa rau xauv tag nrho lub rooj hauv txoj hauv kev uas tiv thaiv txhua yam kev nkag.

Puas yog HashMap tau txais xov zoo?

HashMap tsis yog synchronized. Nws tsis yog xov-kev nyab xeeb thiab tsis tuaj yeem sib koom ntawm ntau cov xov yam tsis muaj kev sib txuas kom raug cai whereas Hashtable yog synchronized.

Vim li cas ConcurrentHashMap tsis nyab xeeb?

pob khoom sib xws xws li ConcurrentHashMap, CopyOnWriteArrayList, thiab lwm yam. yog Fail-Safe in nature. Hauv cov kab lus saum toj no, peb siv Fail-Safe Iterator. Li no, txawm tias ib lub caij tshiab ntxiv rau Sau thaum lub sij hawmiteration, nws tsis cuam ib qho kev zam.

Pom zoo: