예제 #1
0
        public RunnerThread(IComponentFactoryConfiguration cfg, string service, ActionContext context, int iterations, int iterationDelay)
        {
            Cfg              = cfg;
            ServiceName      = service;
            Context          = context;
            IterationsCount  = iterations;
            IterationDelay   = iterationDelay;
            ComponentFactory = new NReco.Application.Ioc.ComponentFactory(Cfg);
            Thrd             = new Thread(new ThreadStart(Execute));

            RunnerThreadsMap.Add(Thrd, this);
        }
예제 #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                var flag = false;
                try {
                    Monitor.Enter(this, ref flag);

                    if (this.site != null && this.site.Container != null)
                    {
                        this.site.Container.Remove(this);
                    }

                    // lets remove references
                    if (componentInstanceByName != null)
                    {
                        componentInstanceByName.Clear();
                    }
                    if (componentInstanceByType != null)
                    {
                        componentInstanceByType.Clear();
                    }
                    if (components != null)
                    {
                        // dispose components
                        foreach (var c in components)
                        {
                            if (c is IDisposable)
                            {
                                ((IDisposable)c).Dispose();
                            }
                        }
                        components.Clear();
                    }
                    componentInstanceByName = null;
                    components = null;

                    _Config = null;

                    if (Disposed != null)
                    {
                        Disposed(this, EventArgs.Empty);
                    }
                } finally {
                    if (flag)
                    {
                        Monitor.Exit(this);
                    }
                }
            }
        }
예제 #3
0
 public ComponentFactory(IComponentFactoryConfiguration config)
     : base(config)
 {
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the ComponentFactory class with specified componet configuration and counters option.
 /// </summary>
 /// <param name="config">IComponentFactoryConfiguration component</param>
 /// <param name="countersEnabled">enables stats counters (component creation / retrieving)</param>
 public ComponentFactory(IComponentFactoryConfiguration config, bool countersEnabled)
 {
     CountersEnabled = countersEnabled;
     Configuration   = config;
     Init();
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the ComponentFactory class with specified componet configuration.
 /// </summary>
 /// <param name="config">IComponentFactoryConfiguration component</param>
 public ComponentFactory(IComponentFactoryConfiguration config) : this(config, false)
 {
 }