Exemple #1
0
        public void DisconnectExecutor()
        {
            //stop execution
            try
            {
                foreach (GExecutor executor in _container.Executors)
                {
                    executor.StopNonDedicatedExecuting();
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error stopping non-dedication execution.", ex);
                Log("Error stopping non-dedication execution.");
            }

            //disconnect
            try
            {
                _container.Disconnect();
                Log("Disconnected successfully.");
            }
            catch (Exception ex)
            {
                logger.Debug("Error disconnecting from Manager.", ex);
                Log("Error disconnecting from Manager." + ex.Message);
            }
        }
Exemple #2
0
        /// <summary>
        /// This could be used for commands such as "reload config", "(re)connect", "disconnect", any other future use etc.
        /// </summary>
        /// <param name="command"></param>
        protected override void OnCustomCommand(int command)
        {
            base.OnCustomCommand(command);
            try
            {
                switch (command)
                {
                case (int)ExecutorServiceCustomCommands.Reload_Config:
                    if (execContainer != null)
                    {
                        logger.Debug("Trying to exec custom command : ReadConfig");
                        execContainer.ReadConfig(false);
                    }
                    else
                    {
                        logger.Debug("Container is null. Not trying to exec custom command : ReadConfig");
                    }
                    break;

                case (int)ExecutorServiceCustomCommands.Disconnect:
                    if (execContainer != null)
                    {
                        logger.Debug("Trying to exec custom command : Disconnect");
                        execContainer.Disconnect();
                    }
                    else
                    {
                        logger.Debug("Container is null. Not trying to exec custom command : Disconnect");
                    }
                    break;

                case (int)ExecutorServiceCustomCommands.Reconnect:
                    if (execContainer != null)
                    {
                        logger.Debug("Trying to exec custom command : Reconnect");
                        execContainer.Reconnect();
                    }
                    else
                    {
                        logger.Debug("Container is null. Not trying to exec custom command : Reconnect");
                    }
                    break;
                }
            }
            catch (Exception e)
            {
                logger.Debug("Error trying to execute custom command : " + command, e);
            }
        }