!23 补充提交 DataBus 性能优化 Lock Free

Merge pull request !23 from 王大锤/lock-free
This commit is contained in:
铂赛东
2021-05-19 17:48:46 +08:00
committed by Gitee

View File

@@ -47,7 +47,7 @@ public class DataBus {
QUEUE = IntStream.range(0, slotSize - 1).boxed().collect(Collectors.toCollection(ConcurrentLinkedQueue::new));
}
public synchronized static int offerSlot(Class<? extends Slot> slotClazz) {
public static int offerSlot(Class<? extends Slot> slotClazz) {
try {
Slot slot = slotClazz.newInstance();
Integer slotIndex = QUEUE.poll();