Пример #1
0
        /// <summary>
        /// The constructor of this class.</summary>
        public CommonStartInfo(AgentType configuration)
        {
            this._configuration = configuration;
            // Get the selected connection, if no connection is enabled it is an error
            this._enabledConnection = configuration.getEnabledConnection();
            if (this._enabledConnection == null)
            {
                LOGGER.Error("No selected connection in the configuration. Exiting ...");
                Environment.Exit(0);
            }
            else
            {
                LOGGER.Info("Selected connection " + this._enabledConnection.GetType().Name);
            }

            // The list of jvm options (default + user defined)
            List <string> mergedJvmOptionsList = new List <string>();

            // Add default parameters
            this._enabledConnection.fillDefaultJvmOptions(mergedJvmOptionsList, this._configuration.config.proactiveHome);
            // Add user defined
            if (this._configuration.config.jvmParameters != null)
            {
                mergedJvmOptionsList.AddRange(this._configuration.config.jvmParameters);
            }
            this._jvmOptions = mergedJvmOptionsList.ToArray();

            // The system env variable must not be null otherwise the delay is not enabled
            string value = System.Environment.GetEnvironmentVariable("PA_AGENT_RUNTIME_START_DELAY", EnvironmentVariableTarget.Machine);

            if (value != null)
            {
                if (!Int32.TryParse(value, out this._runtimeStartDelayInMs))
                {
                    LOGGER.Warn("Unable to parse the runtime start delay using default value " + this._runtimeStartDelayInMs + " ms");
                }
                else
                {
                    this._runtimeStartDelayEnabled = true;
                    LOGGER.Info("Runtime start delay is set to " + this._runtimeStartDelayInMs + " ms");
                }
            }
            this._cpuLimiterEnabled = !(configuration.isAlwaysAvailable() && configuration.config.maxCpuUsage == 100);
        }