package com.tsi.comm.server.repository;

import com.tsi.comm.server.vo.TsiNodeAddVo;

import java.util.concurrent.ConcurrentHashMap;

public class TsiNodeAddManager {

    private static TsiNodeAddManager _instance = null;

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

    private TsiNodeAddManager() {
        this.tsiNodeAddMap = new ConcurrentHashMap<>();
    }

    private ConcurrentHashMap<Long, TsiNodeAddVo> tsiNodeAddMap;

    public TsiNodeAddVo get(long nodeId) {
        return this.tsiNodeAddMap.get(nodeId);
    }
    public void put(long nodeId, TsiNodeAddVo vo) {
        this.tsiNodeAddMap.put(nodeId, vo);
    }

    public int size() {
        return this.tsiNodeAddMap.size();
    }

    public boolean containsKey(long key) {
        return this.tsiNodeAddMap.containsKey(key);
    }

}
