package com.its.vms.global;

import com.its.vms.dto.TbVmsCtlrDto;
import io.netty.channel.Channel;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ConcurrentHashMap;

@Getter
@Setter
@Slf4j
public class AppRepository {
    private static AppRepository _instance = null;

    public ConcurrentHashMap<Long, TbVmsCtlrDto> ctlrMap = null;
    public ConcurrentHashMap<String, TbVmsCtlrDto> ctlrIpMap = null;
    public ConcurrentHashMap<Channel, TbVmsCtlrDto> ctlrChannelMap = null;

//    public static AppRepository getInstance() {
//        if (_instance == null) {
//            synchronized (AppRepository.class) {
//                if (_instance == null)
//                    _instance = new AppRepository();
//            }
//        }
//        return _instance;
//    }

    public AppRepository() {
        this.ctlrMap = new ConcurrentHashMap<>();
        this.ctlrIpMap = new ConcurrentHashMap<>();
        this.ctlrChannelMap = new ConcurrentHashMap<>();
    }

}
