enhancement #I49JP1 DataBus中SlotSize的大小不支持动态扩展,无法应对高并发下的流量突增

This commit is contained in:
bryan31
2021-09-18 19:15:51 +08:00
parent 3fe1e35f45
commit a8e02d9fd8

View File

@@ -52,6 +52,10 @@ public class DataBus {
public static int offerSlot(Class<? extends Slot> slotClazz) {
try {
Slot slot = slotClazz.newInstance();
//这里有没有并发问题?
//没有因为QUEUE的类型为ConcurrentLinkedQueue并发情况下每次取到的index不会相同
//当然前提是QUEUE里面的值不会重复但是这个是由其他机制来保证的
Integer slotIndex = QUEUE.poll();
if (ObjectUtil.isNull(slotIndex)){