Exemplo n.º 1
0
 protected override void Destructor()
 {
     lock (s_InstanceLock)
     {
         base.Destructor();
         s_Instance = null;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a singleton instance or throws if instance is already created
        /// </summary>
        public HostGovernorService(bool launchedByARD, bool ardUpdateProblem) : base(null)
        {
            if (!AgniSystem.IsMetabase)
            {
                throw new AHGOVException(StringConsts.METABASE_NOT_AVAILABLE_ERROR.Args(GetType().FullName + ".ctor()"));
            }

            lock (s_InstanceLock)
            {
                if (s_Instance != null)
                {
                    throw new AHGOVException(StringConsts.AHGOV_INSTANCE_ALREADY_ALLOCATED_ERROR);
                }

                m_LaunchedByARD    = launchedByARD;
                m_ARDUpdateProblem = ardUpdateProblem;

                var exeName = System.Reflection.Assembly.GetEntryAssembly().Location;
                m_RootPath = Directory.GetParent(Path.GetDirectoryName(exeName)).FullName;

                s_Instance = this;
            }
        }