package com.jpsoft.shinestar.modules.uniview.channel;

import io.netty.channel.Channel;
import lombok.Data;

import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

@Data
public class LapiChannel {
    private Channel channel;

    //不同的uri对应一个接受队列
    private Map<String,BlockingQueue<String>> receivePacketQueueMap;

    public BlockingQueue<String> getReceivePacketQueue(String uri) {
        if(!this.receivePacketQueueMap.containsKey(uri)){
            BlockingQueue<String> queue =  new ArrayBlockingQueue<>(100);
            receivePacketQueueMap.put(uri,queue);
        }

        return this.receivePacketQueueMap.get(uri);
    }
}
