jjzjj

updatesPerId

全部标签

Java: get+clear atomic for map

我想实现以下逻辑:-将使用以下结构//Mapkeepingthependingupdates//groupedbytheidoftheupdatedobjectfinalMap>updatesPerId=newConcurrentHashMap();-n个生产者会向updatesPerIdmap添加更新(对于同一个id,可以同时添加2个更新)-oneTimerThread会时不时地运行,并且必须处理接收到的更新。像这样的东西:finalMap>toBeProcessed=newHashMap(updatesPerId);updatesPerId.clear();//iterateove