コード例 #1
0
ファイル: InternalShared.cs プロジェクト: bluetsys/alchemi
 /// <summary>
 /// Gets an instance of this class (creates it, the first time).
 /// </summary>
 /// <returns></returns>
 internal static InternalShared GetInstance(Configuration config)
 {
     if (Instance == null)
     {
         Instance = new InternalShared(config);
     }
     return(Instance);
 }
コード例 #2
0
ファイル: InternalShared.cs プロジェクト: JamesTryand/alchemi
 /// <summary>
 /// Gets an instance of this class (creates it, the first time).
 /// </summary>
 /// <returns></returns>
 internal static InternalShared GetInstance(Configuration config)
 {
     if (Instance == null)
     {
         Instance = new InternalShared(config);
     }
     return Instance;
 }
コード例 #3
0
ファイル: InternalShared.cs プロジェクト: cucacutexice/AIGA
 /// <summary>
 /// Gets an instance of this class (creates it, the first time).
 /// </summary>
 /// <!--param name="database"></param-->
 /// <param name="dataRootDirectory"></param>
 /// <param name="scheduler"></param>
 /// <returns></returns>
 public static InternalShared GetInstance(string dataRootDirectory, IScheduler scheduler)
 {
     if (Instance == null)
     {
         if (!Directory.Exists(dataRootDirectory))
         {
             Directory.CreateDirectory(dataRootDirectory);
         }
         Instance = new InternalShared(dataRootDirectory, scheduler);
     }
     return(Instance);
 }
コード例 #4
0
ファイル: InternalShared.cs プロジェクト: abhishek-kumar/AIGA
 /// <summary>
 /// Gets an instance of this class (creates it, the first time).
 /// </summary>
 /// <!--param name="database"></param-->
 /// <param name="dataRootDirectory"></param>
 /// <param name="scheduler"></param>
 /// <returns></returns>
 public static InternalShared GetInstance(string dataRootDirectory, IScheduler scheduler)
 {
     if (Instance == null)
     {
         if (!Directory.Exists(dataRootDirectory))
         {
             Directory.CreateDirectory(dataRootDirectory);
         }
         Instance = new InternalShared(dataRootDirectory, scheduler);
     }
     return Instance;
 }
コード例 #5
0
ファイル: ManagerContainer.cs プロジェクト: bluetsys/alchemi
        /// <summary>
        /// Starts the Manager
        /// </summary>
        public void Start()
        {
            if (Started || _Starting)
            {
                return;
            }

            try
            {
                _Starting = true;

                if (Config == null)
                {
                    ReadConfig();
                }

                //See if there is any remoting end poit.
                //There can be only one remoting end point.
                //See if there are any WCF end point. Thre can be more WCF end points.
                EndPointConfiguration remotingEpc = null;
                bool areAnyWcfEps = false;

                foreach (string key in Config.EndPoints.Keys)
                {
                    EndPointConfiguration epc = Config.EndPoints[key];
                    if (epc.RemotingMechanism == RemotingMechanism.TcpBinary)
                    {
                        if (remotingEpc != null)
                        {
                            throw new DoubleRemotingEndPointException("Cannot set two EndPoint where Rempting Mechanism is set to TcpBinary");
                        }

                        remotingEpc = epc;
                    }
                    else
                    {
                        areAnyWcfEps = true;
                    }
                }

                if (remotingEpc != null)
                {
                    StartTcpBinary(remotingEpc);
                }

                if (areAnyWcfEps)
                {
                    StartWCF();
                }


                logger.Debug("Configuring storage...");
                ManagerStorageFactory.CreateManagerStorage(Config);
                if (!ManagerStorageFactory.ManagerStorage().VerifyConnection())
                {
                    throw new Exception("Error connecting to manager storage. Please check manager log file for details.");
                }

                logger.Debug("Configuring internal shared class...");
                InternalShared common = InternalShared.GetInstance(Config);

                logger.Debug("Starting dispatcher thread");
                dispatcher.Start();

                logger.Info("Starting watchdog thread");
                watchdog.Start();

                //start a seperate thread to init-known executors, since this may take a while.
                _InitExecutorsThread      = new Thread(new ThreadStart(InitExecutors));
                _InitExecutorsThread.Name = "InitExecutorsThread";
                _InitExecutorsThread.Start();

                Config.Serialize();

                Started = true;

                try
                {
                    if (ManagerStartEvent != null)
                    {
                        ManagerStartEvent(this, new EventArgs());
                    }
                }
                catch { }
            }
            catch (Exception ex)
            {
                Stop();
                logger.Error("Error Starting Manager Container", ex);
                throw ex;
            }
            finally
            {
                _Starting = false;
            }
        }