ACR_DatabaseConnector.ACR_DatabaseConnector.InitializeDatabaseConnector C# (CSharp) Method

InitializeDatabaseConnector() private method

Initialize the database connector.
private InitializeDatabaseConnector ( ) : void
return void
        private void InitializeDatabaseConnector()
        {
            if (Connector != null)
                return;

            //
            // Create a secure tunnel to the database and wait for it to finish
            // coming online (internal to the DatabaseConnector).  In the event
            // of any failure, log an error and exit the server process as the
            // server cannot successfully initialize without a database (to do
            // so will result in the server getting into a potentially invalid
            // state and needing a manual reset later anyway when it might have
            // been less obvious why systems did not work properly).
            //

            try
            {
                Connector = new DatabaseConnector(this);
            }
            catch (Exception e)
            {
                Logger.FlushLogMessages(this);
                WriteTimestampedLogEntry(String.Format("ACR_DatabaseConnector.InitializeDatabaseConnector: DatabaseConnector.DatabaseConnector raised exception '{0}'.", e));
                WriteTimestampedLogEntry("Shutting down the game server because the database is unavailable.");
                ALFA.SystemInfo.ShutdownGameServer(this);
            }

            Logger.FlushLogMessages(this);
        }