public static void Put(PlantUmlConnection connection)
 {
     lock (_connectionPool)
         _connectionPool.Enqueue(connection);
         
     _availableEvent.Set();
 }
Exemple #2
0
    public static void Put(PlantUmlConnection connection)
    {
        lock (_connectionPool)
            _connectionPool.Enqueue(connection);

        _availableEvent.Set();
    }
Exemple #3
0
    public static void Startup()
    {
        if (_processes.Count > 0)
        {
            Shutdown();
        }

        var javaPath = ConfigurationManager.AppSettings["java"];

        if (!File.Exists(javaPath))
        {
            throw new ApplicationException("Java.exe not found: " + javaPath);
        }

        var host      = ConfigurationManager.AppSettings["plantuml.host"];
        var startPort = Convert.ToInt32(ConfigurationManager.AppSettings["plantuml.start_port"]);
        var instances = Convert.ToInt32(ConfigurationManager.AppSettings["plantuml.instances"]);

        var plantumlPath = ConfigurationManager.AppSettings["plantuml.path"];

        if (!File.Exists(plantumlPath))
        {
            throw new ApplicationException("plantuml.jar not found in " + plantumlPath);
        }

        for (int i = 0; i < instances; i++)
        {
            var argument           = "-jar " + plantumlPath + " -ftp:" + (startPort + i);
            ProcessStartInfo pInfo = new ProcessStartInfo(javaPath, argument);

            pInfo.CreateNoWindow         = true;
            pInfo.UseShellExecute        = false;
            pInfo.RedirectStandardInput  = true;
            pInfo.RedirectStandardError  = true;
            pInfo.RedirectStandardOutput = true;

            Process process = Process.Start(pInfo);
            Thread.Sleep(5000);
            _processes.Add(process);

            PlantUmlConnection connection = new PlantUmlConnection();
            connection.Connect(host, startPort + i);
            PlantUmlConnectionPool.Put(connection);
        }
    }
    public static void Startup()
    {
        if (_processes.Count > 0)
            Shutdown();

        var javaPath = ConfigurationManager.AppSettings["java"];

        if (!File.Exists(javaPath))
            throw new ApplicationException("Java.exe not found: " + javaPath);

        var host = ConfigurationManager.AppSettings["plantuml.host"];
        var startPort = Convert.ToInt32(ConfigurationManager.AppSettings["plantuml.start_port"]);
        var instances = Convert.ToInt32(ConfigurationManager.AppSettings["plantuml.instances"]);
            
        var plantumlPath = ConfigurationManager.AppSettings["plantuml.path"];
        if (!File.Exists(plantumlPath))
            throw new ApplicationException("plantuml.jar not found in " + plantumlPath);

        for (int i = 0; i < instances; i++)
        {
            var argument = "-jar " + plantumlPath + " -ftp:" + (startPort + i);
            ProcessStartInfo pInfo = new ProcessStartInfo(javaPath, argument);

            pInfo.CreateNoWindow = true;
            pInfo.UseShellExecute = false;
            pInfo.RedirectStandardInput = true;
            pInfo.RedirectStandardError = true;
            pInfo.RedirectStandardOutput = true;
                
            Process process = Process.Start(pInfo);
            Thread.Sleep(5000);
            _processes.Add(process);

            PlantUmlConnection connection = new PlantUmlConnection();
            connection.Connect(host, startPort + i);
            PlantUmlConnectionPool.Put(connection);
        }
    }