All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.airlenet.netconf.common.PlayNetconfPool Maven / Gradle / Ivy

The newest version!
package com.airlenet.netconf.common;

import com.tailf.jnc.JNCException;

import java.io.IOException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Created by airlenet on 17/8/24.
 */
public class PlayNetconfPool {


    private static ConcurrentHashMap> playDeviceMap;


    public static PlayNetconfSession getNetconfSession(PlayNetconfDevice playNetconfDevice) throws IOException, JNCException, InterruptedException {
        BlockingQueue playNetconfSessions = playDeviceMap.get(playNetconfDevice);
        if(playNetconfSessions.isEmpty()){
            playNetconfSessions.add(playNetconfDevice.getDefaultNetconfSession());
        }
        return playNetconfSessions.take();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy