Exemple #1
0
 /// <summary>
 /// 关闭矿建,销毁框架实例
 /// </summary>
 public void Close()
 {
     if (adaptor == null)
     {
         return;
     }
     if (active)
     {
         Shutdown();
     }
     lock (bundles)
     {
         IList allBundles = bundles.GetBundles();
         int   size       = allBundles.Count;
         for (int i = 0; i < size; i++)
         {
             AbstractBundle bundle = (AbstractBundle)allBundles[i];
             bundle.Close();
         }
         bundles.RemoveAllBundles();
     }
     serviceRegistry = null;
     adaptor         = null;
     assemblyResolver.Stop();
     assemblyResolver = null;
 }
        /**
         * Build an array of all installed bundles to be launch.
         * The returned array is sorted by increasing startlevel/id order.
         * @param bundles - the bundles installed in the framework
         * @return A sorted array of bundles
         */
        internal AbstractBundle[] GetInstalledBundles(BundleRepository bundles, bool sortByDependency)
        {
            /* make copy of bundles vector in case it is modified during launch */
            AbstractBundle[] installedBundles;

            lock (bundles)
            {
                IList allBundles = bundles.GetBundles();
                installedBundles = new AbstractBundle[allBundles.Count];
                allBundles.CopyTo(installedBundles, 0);

                /* Sort bundle array in ascending startlevel / bundle id order
                 * so that bundles are started in ascending order.
                 */
                BundleUtil.Sort(installedBundles, 0, installedBundles.Length);
                //if (sortByDependency)
                //    SortByDependency(installedBundles);
            }
            return(installedBundles);
        }