示例#1
0
 /// <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
 /// <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
 /// <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
 /// <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
        /// <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;
            }
        }