Changeset 7142


Ignore:
Timestamp:
12/06/11 19:21:45 (10 years ago)
Author:
ascheibe
Message:

#1672 implemented reviewing comments

Location:
trunk/sources/HeuristicLab.Clients.Hive/3.3
Files:
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HeuristicLab.Clients.Hive-3.3.csproj

    r7133 r7142  
    167167    <Compile Include="ServiceClients\Heartbeat.cs" />
    168168    <Compile Include="ServiceClients\HiveItem.cs" />
    169     <Compile Include="ServiceClients\JobData.cs" />
     169    <Compile Include="ServiceClients\TaskData.cs" />
    170170    <Compile Include="ServiceClients\Plugin.cs" />
    171171    <Compile Include="ServiceClients\PluginData.cs" />
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveJobs/EngineHiveTask.cs

    r6976 r7142  
    5555      IEnumerable<Type> usedTypes;
    5656
    57       // clone operation and remove unnecessary scopes; don't do this earlier to avoid memory problems
    58       //lock (locker) {
    59         ((IAtomicOperation)ItemTask.InitialOperation).Scope.Parent = parentScopeClone;
    60         ItemTask.InitialOperation = (IOperation)ItemTask.InitialOperation.Clone();
    61         ((IAtomicOperation)ItemTask.InitialOperation).Scope.ClearParentScopes();
    62         jobData.Data = PersistenceUtil.Serialize(ItemTask, out usedTypes);
    63       //}
     57      // clone operation and remove unnecessary scopes; don't do this earlier to avoid memory problems     
     58      ((IAtomicOperation)ItemTask.InitialOperation).Scope.Parent = parentScopeClone;
     59      ItemTask.InitialOperation = (IOperation)ItemTask.InitialOperation.Clone();
     60      ((IAtomicOperation)ItemTask.InitialOperation).Scope.ClearParentScopes();
     61      jobData.Data = PersistenceUtil.Serialize(ItemTask, out usedTypes);
    6462
    6563      // add type objects from object graph to work around ticket #1527
     
    6866
    6967      PluginUtil.CollectDeclaringPlugins(plugins, usedTypes);
    70      
     68
    7169      return jobData;
    7270    }
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveJobs/OptimizerHiveTask.cs

    r7125 r7142  
    354354      int idx = run.Name.IndexOf("Run ") + 4;
    355355
    356       if (idx == -1 || runs.Count == 0)
     356      if (idx == 3 || runs.Count == 0)
    357357        return run.Name;
    358358
     
    371371    private static int GetRunNumber(string runName) {
    372372      int idx = runName.IndexOf("Run ") + 4;
    373       if (idx == -1) {
     373      if (idx == 3) {
    374374        return 0;
    375375      } else {
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveServiceLocator.cs

    r7132 r7142  
    3333        return instance;
    3434      }
    35       set {
    36         instance = value;
    37       }
    3835    }
    3936
     
    5653      else
    5754        cl = ClientFactory.CreateClient<HiveServiceClient, IHiveService>(null, null, username, password);
    58      
     55
    5956      return cl;
    6057    }
     
    6461      try {
    6562        return call(client);
    66       }
    67       finally {
     63      } finally {
    6864        try {
    6965          client.Close();
     
    7975      try {
    8076        call(client);
    81       }
    82       finally {
     77      } finally {
    8378        try {
    8479          client.Close();
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/JobResultPoller.cs

    r7132 r7142  
    2727namespace HeuristicLab.Clients.Hive {
    2828  public class JobResultPoller {
    29     private bool stopRequested { get; set; }
     29    private bool stopRequested;
    3030    private AutoResetEvent waitHandle;
    3131    private Thread thread;
     
    9696        catch (Exception e) {
    9797          OnExceptionOccured(e);
    98         }
    99         finally {
     98        } finally {
    10099          IsPolling = false;
    101100        }
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/Util/PersistenceUtil.cs

    r6976 r7142  
    2929  public static class PersistenceUtil {
    3030    public static byte[] Serialize(object obj, out IEnumerable<Type> types) {
    31       MemoryStream memStream = new MemoryStream();
    32       XmlGenerator.Serialize(obj, memStream, ConfigurationService.Instance.GetConfiguration(new XmlFormat()), false, out types);
    33       byte[] jobByteArray = memStream.ToArray();
    34       memStream.Dispose();
    35       return jobByteArray;
     31      using (MemoryStream memStream = new MemoryStream()) {
     32        XmlGenerator.Serialize(obj, memStream, ConfigurationService.Instance.GetConfiguration(new XmlFormat()), false, out types);
     33        byte[] jobByteArray = memStream.ToArray();
     34        return jobByteArray;
     35      }
    3636    }
    3737
    3838    public static byte[] Serialize(object obj) {
    39       MemoryStream memStream = new MemoryStream();
    40       XmlGenerator.Serialize(obj, memStream);
    41       byte[] jobByteArray = memStream.ToArray();
    42       memStream.Dispose();
    43       return jobByteArray;
     39      using (MemoryStream memStream = new MemoryStream()) {
     40        XmlGenerator.Serialize(obj, memStream);
     41        byte[] jobByteArray = memStream.ToArray();
     42        return jobByteArray;
     43      }
    4444    }
    4545
    4646    public static T Deserialize<T>(byte[] sjob) {
    47       MemoryStream memStream = new MemoryStream(sjob);
    48       T job = XmlParser.Deserialize<T>(memStream);
    49       memStream.Dispose();
    50       return job;
     47      using (MemoryStream memStream = new MemoryStream(sjob)) {
     48        T job = XmlParser.Deserialize<T>(memStream);
     49        return job;
     50      }
    5151    }
    5252  }
Note: See TracChangeset for help on using the changeset viewer.