Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1990


Ignore:
Timestamp:
06/02/09 14:14:47 (15 years ago)
Author:
gkronber
Message:
  • Refactoring: renamed method LoadPlugins to LoadAssemblies in class Runner.
  • Added cache of loaded assemblies in the Runner.
  • Added an AssemblyResolveEvent that returns already loaded assemblies from the cache.

#658 (For the execution of jobs assemblies have to be loaded dynamically in the correct order)

Location:
trunk/sources
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Core/3.2/Core.cs

    r1959 r1990  
    244244          files.AddRange(plugininfo.PluginFiles);
    245245       
    246         AppDomain appDomain = PluginManager.Manager.CreateAndInitAppDomainWithSandbox(e.Result.Job.Id.ToString(), sandboxed, null, files);       
     246        AppDomain appDomain = PluginManager.Manager.CreateAndInitAppDomainWithSandbox(e.Result.Job.Id.ToString(), sandboxed, null, files);
    247247        appDomain.UnhandledException += new UnhandledExceptionEventHandler(appDomain_UnhandledException);
    248248        lock (engines) {                   
     
    265265      currentlyFetching = false;
    266266    }
    267    
    268267
    269268    void wcfService_StoreFinishedJobResultCompleted(object sender, StoreFinishedJobResultCompletedEventArgs e) {
  • trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/3.2/Executor.cs

    r1936 r1990  
    5353    public void Start(byte[] serializedJob) {
    5454      CreationTime = DateTime.Now;
    55      
    5655      Job = (IJob)PersistenceManager.RestoreFromGZip(serializedJob);
    5756      //debug
  • trunk/sources/HeuristicLab.Hive.Engine/3.2/HiveEngine.cs

    r1925 r1990  
    172172    public void Abort() {
    173173      IExecutionEngineFacade executionEngineFacade = ServiceLocator.CreateExecutionEngineFacade(HiveServerUrl);
    174 
    175       //This are just Stubs on the server right now. There won't be any effect right now...
    176174      executionEngineFacade.AbortJob(jobId);
    177175      OnFinished();
  • trunk/sources/HeuristicLab.PluginInfrastructure/PluginManager.cs

    r1936 r1990  
    229229
    230230      if (assemblyFiles != null && assemblyFiles.Count > 0)
    231         remoteRunner.LoadPlugins(assemblyFiles);
     231        remoteRunner.LoadAssemblies(assemblyFiles);
    232232     
    233233      //if (depPlugins != null && depPlugins.Count > 0) {       
  • trunk/sources/HeuristicLab.PluginInfrastructure/Runner.cs

    r1936 r1990  
    3030  public class Runner : MarshalByRefObject {
    3131
     32    private Dictionary<string, Assembly> loadedAssemblies;
     33
     34    public Runner() {
     35      loadedAssemblies = new Dictionary<string, Assembly>();
     36      AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => {
     37        if(loadedAssemblies.ContainsKey(args.Name)) {
     38          return loadedAssemblies[args.Name];
     39        }
     40        return null;
     41      };
     42    }
     43
    3244    public void LoadPlugins(ICollection<PluginInfo> plugins) {
    3345      //FileIOPermission fileperm = new FileIOPermission(FileIOPermissionAccess.AllAccess, @"C:\Program Files\HeuristicLab 3.0\plugins\");
     
    4355    }
    4456    /// <summary>
    45     /// Loads plugins from a byte array
     57    /// Loads assemblies from a byte array
    4658    /// </summary>
    47     /// <param name="plugins">bytearray of all plugins that should be loaded</param>
    48     public void LoadPlugins(ICollection<byte[]> plugins) {
    49       foreach (byte[] plugin in plugins) {
    50         Assembly.Load(plugin);       
     59    /// <param name="plugins">bytearray of all assemblies that should be loaded</param>
     60    public void LoadAssemblies(ICollection<byte[]> assemblies) {
     61      foreach (byte[] asm in assemblies) {
     62        Assembly loadedAsm = Assembly.Load(asm);
     63        RegisterLoadedAssembly(loadedAsm);
    5164      }
     65    }
     66
     67    private void RegisterLoadedAssembly(Assembly asm) {
     68      loadedAssemblies.Add(asm.FullName, asm);
     69      loadedAssemblies.Add(asm.GetName().Name, asm); // add short name
    5270    }
    5371
Note: See TracChangeset for help on using the changeset viewer.