
package cn.orionsec.ops.handler.app.release;

import cn.orionsec.kit.lang.utils.collect.Maps;
import org.springframework.stereotype.Component;

import java.util.concurrent.ConcurrentHashMap;

@Component
public class ReleaseSessionHolder {

    /**
     * session
     */
    private final ConcurrentHashMap<Long, IReleaseProcessor> session = Maps.newCurrentHashMap();

    /**
     * 添加 session
     *
     * @param processor processor
     */
    public void addSession(IReleaseProcessor processor) {
        session.put(processor.getReleaseId(), processor);
    }

    /**
     * 获取 session
     *
     * @param id id
     * @return session
     */
    public IReleaseProcessor getSession(Long id) {
        return session.get(id);
    }

    /**
     * 移除 session
     *
     * @param id id
     */
    public void removeSession(Long id) {
        session.remove(id);
    }

}
