Esempio n. 1
0
        /// <summary>
        /// Creates a singleton instance or throws if instance is already created
        /// </summary>
        public ZoneGovernorService() : base(null)
        {
            if (!AgniSystem.IsMetabase)
            {
                throw new AZGOVException(StringConsts.METABASE_NOT_AVAILABLE_ERROR.Args(GetType().FullName + ".ctor()"));
            }

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

                m_SubInstr = new InstrumentationService(this);
                m_SubInstrReductionLevels = new Dictionary <string, int>();
                m_SubInstrCallers         = new ConcurrentDictionary <string, DateTime>();

                m_SubLog = new LogService(this);

                m_SubHosts         = new Registry <Contracts.HostInfo>();
                m_DynamicHostSlots = new Registry <Contracts.DynamicHostInfo>();

                m_Locker = new Locking.Server.LockServerService(this);

                s_Instance = this;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a singleton instance or throws if instance is already created
        /// </summary>
        public ZoneGovernorService(IApplication app) : base(app)
        {
            if (!App.Singletons.GetOrCreate(() => this).created)
            {
                throw new AZGOVException(StringConsts.AZGOV_INSTANCE_ALREADY_ALLOCATED_ERROR);
            }

            m_SubInstr = new InstrumentationDaemon(this);
            m_SubInstrReductionLevels = new Dictionary <string, int>();
            m_SubInstrCallers         = new ConcurrentDictionary <string, DateTime>();

            m_SubLog = new LogDaemon(this);

            m_SubHosts         = new Registry <Contracts.HostInfo>();
            m_DynamicHostSlots = new Registry <Contracts.DynamicHostInfo>();

            m_Locker = new Locking.Server.LockServerService(this);
        }