Exemplo n.º 1
0
 protected override void DoStop(BundleStopOptions option)
 {
     if (((base.State != BundleState.Starting) && (base.State != BundleState.Stopping)) && base.IsActive)
     {
         base.State = BundleState.Stopping;
         IBundleContext context   = base.Context;
         Exception      exception = null;
         try
         {
             if (this.Activator != null)
             {
                 this.Activator.Stop(context);
             }
         }
         catch (Exception exception2)
         {
             FileLogUtility.Error(string.Format(Messages.ExceptionOccursWhenStopping, base.SymbolicName, base.Version));
             FileLogUtility.Error(exception2);
             exception = exception2;
         }
         this.CheckValidState();
         base.State = BundleState.Resolved;
         if (option == BundleStopOptions.General)
         {
             this.SavePersistent();
         }
         base.Context.Dispose();
         base.Context = null;
         if (exception != null)
         {
             throw exception;
         }
     }
 }
Exemplo n.º 2
0
        public void Stop(string bundleSymbolicName, BundleStopOptions option)
        {
            IBundle bundleBySymbolicName = Framework.GetBundleBySymbolicName(bundleSymbolicName);

            if (bundleBySymbolicName != null)
            {
                bundleBySymbolicName.Stop(option);
            }
        }
Exemplo n.º 3
0
 public override void Stop(BundleStopOptions option)
 {
     if (base.State == BundleState.Active)
     {
         new Thread(delegate {
             Stopwatch stopwatch = new Stopwatch();
             try
             {
                 stopwatch.Start();
                 base.Framework.Stop();
             }
             finally
             {
                 stopwatch.Stop();
                 FileLogUtility.Verbose(string.Format(Messages.StopSystemBundleTimeCounter, stopwatch.ElapsedMilliseconds));
             }
         }).Start();
     }
 }
Exemplo n.º 4
0
        protected override void DoStop(BundleStopOptions option)
        {
            int startLevel;

            if (base.State == BundleState.Active)
            {
                base.State = BundleState.Stopping;
                startLevel = base.Framework.StartLevelManager.StartLevel;
                List <IBundle> list = base.Framework.Bundles.FindAll(bundle => bundle.GetBunldeStartLevel() <= startLevel);
                list.Sort((bundle1, bundle2) => bundle2.GetBunldeStartLevel().CompareTo(bundle1.GetBunldeStartLevel()));
                int num = 0;
                while (true)
                {
                    if (num >= list.Count)
                    {
                        break;
                    }
                    HostBundle bundle = list[num] as HostBundle;
                    if (bundle != null)
                    {
                        try
                        {
                            list[num].Stop(BundleStopOptions.Transient);
                            base.Framework.EventManager.DispatchFrameworkEvent(this, new FrameworkEventArgs(FrameworkEventType.Stopped, list[num]));
                        }
                        catch (Exception exception)
                        {
                            FileLogUtility.Error(string.Format(Messages.StopBundleFailed, bundle.SymbolicName, bundle.Version));
                            FileLogUtility.Error(exception);
                            base.Framework.EventManager.DispatchFrameworkEvent(this, new FrameworkEventArgs(FrameworkEventType.Error, list[num], exception));
                        }
                    }
                    num++;
                }
                base.State = BundleState.Resolved;
            }
        }
Exemplo n.º 5
0
 protected override void DoStop(BundleStopOptions option)
 {
     throw new BundleException(Messages.FragmentBundleCanNotBeStopped);
 }
Exemplo n.º 6
0
 public virtual void Stop(BundleStopOptions option)
 {
     FileLogUtility.Debug(string.Format(Messages.BundleStopping, SymbolicName, Version));
     DoLifecycleAction(() => DoStop(option), Messages.StopAction);
     FileLogUtility.Debug(string.Format(Messages.BundleInState, SymbolicName, Version, State));
 }
Exemplo n.º 7
0
 protected abstract void DoStop(BundleStopOptions option);