Example #1
0
        private static bool Initialize()
        {
            LoggingExtensions.Logging.Log.InitializeWith <LoggingExtensions.log4net.Log4NetLog>();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            _configFile.Log().Info("Server Start!");
            if (!_configFile.LoadConfigFile())
            {
                Logger.FATAL("Unable to load ConfigFile!");
                return(false);
            }

            Logger.INFO("Initialize I/O handlers manager");
            IOHandlerManager.Initialize();
            if (!_configFile.ConfigModules())
            {
                Logger.FATAL("Unable to configure modules");
                return(false);
            }
            Logger.INFO("Plug in the default protocol factory");
            _protocolFactory = new DefaultProtocolFactory();
            if (!_protocolFactory.RegisterProtocolFactory())
            {
                Logger.FATAL("Unable to register default protocols factory");
                return(false);
            }
            Logger.INFO("Configure factories");
            if (!_configFile.ConfigFactories())
            {
                Logger.FATAL("Unable to configure factories");
                return(false);
            }
            Logger.INFO("Configure acceptors");
            if (!_configFile.ConfigAcceptors())
            {
                Logger.FATAL("Unable to configure acceptors");
                return(false);
            }

            Logger.INFO("Configure instances");
            if (!_configFile.ConfigInstances())
            {
                Logger.FATAL("Unable to configure instances");
                return(false);
            }

            Logger.INFO("Start I/O handlers manager");
            IOHandlerManager.Start();

            Logger.INFO("Configure applications");
            if (!_configFile.ConfigApplications())
            {
                Logger.FATAL("Unable to configure applications");
                return(false);
            }

            //Logger.INFO("Install the quit signal");
            //installQuitSignal(QuitSignalHandler);

            return(true);
        }