Exemple #1
0
 /// <summary>
 /// Cleans up the instance of the <see cref="TypeSpecificStatisticsManager"/> class.
 /// </summary>
 internal void Shutdown()
 {
     lock (_instanceLock)
     {
         _typeSettingStatusCollection = null;
         _initialized = false;
         //Release instance to free memory and to get initialized fresh.
         _instance = null;
     }
 }
Exemple #2
0
 /// <summary>
 /// this (or <see cref="ReloadConfig"/>) gets called (depending) when the TypeSettings.Config file
 /// are changed.
 /// </summary>
 /// <remarks>
 /// Added: craigbro
 /// cachedTypeSettings now held with the forwarder for reference of
 /// exceptions on Synchronous "in" messages.
 /// To reload, we just null out the cached TypeSettingsCollection object and the
 /// accessor will reload it on next call
 /// While ConfigurationManager.GetSection is quite performant after the 1st hit,
 /// keeping them cached is about twice as fast.
 /// </remarks>
 /// <param name="config"></param>
 /// <param name="runState"></param>
 private void LoadConfig(RelayNodeConfig config, ComponentRunState runState)
 {
     if (config != null)
     {
         if (config.RelayComponents != null)
         {
             object           configObject     = config.RelayComponents.GetConfigFor(GetComponentName());
             ForwardingConfig forwardingConfig = configObject as ForwardingConfig;
             if (forwardingConfig == null)
             {
                 if (log.IsInfoEnabled)
                 {
                     log.Info("No forwarding configuration supplied. Using defaults.");
                 }
                 forwardingConfig = new ForwardingConfig();
             }
             NodeManager.Initialize(config, forwardingConfig, GetErrorQueues(runState));
             TypeSettingCollection typeSettingCollection = null;
             if (NodeManager.Instance.Config != null)
             {
                 if (NodeManager.Instance.Config.TypeSettings != null)
                 {
                     typeSettingCollection = NodeManager.Instance.Config.TypeSettings.TypeSettingCollection;
                 }
             }
             TypeSpecificStatisticsManager.Initialize(typeSettingCollection);
             _enableAsyncBulkGets = forwardingConfig.EnableAsyncBulkGets;
             _myNodeDefinition    = NodeManager.Instance.GetMyNodeDefinition();
             _myZone = Node.DetermineZone(_myNodeDefinition);
             short maxTypeId = 0;
             if (config.TypeSettings != null)
             {
                 maxTypeId = config.TypeSettings.MaxTypeId;
             }
             DebugWriter.SetTraceSettings(maxTypeId, forwardingConfig.TraceSettings);
             DebugWriter.WriteCallingMethod = forwardingConfig.WriteCallingMethod;
             DebugWriter.WriteMessageTrace  = forwardingConfig.WriteMessageTrace;
         }
         else
         {
             NodeManager.Initialize(null, null, null);
             TypeSpecificStatisticsManager.Initialize(null);
         }
     }
     else
     {
         NodeManager.Initialize(null, null, null);
         TypeSpecificStatisticsManager.Initialize(null);
     }
 }
Exemple #3
0
        private static TypeSpecificStatisticsManager GetInstance()
        {
            //use local var because we set _instance to null on shutdown and could
            //cause concurrency problem
            TypeSpecificStatisticsManager instance = _instance;

            if (instance == null)
            {
                lock (_instanceLock)
                {
                    if (_instance == null)
                    {
                        _instance = new TypeSpecificStatisticsManager();
                    }
                    instance = _instance;
                }
            }
            return(instance);
        }