- Timestamp:
- 03/18/19 17:24:30 (6 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/2521_ProblemRefactoring/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r12926 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 96 96 var jobsLoaded = HiveServiceLocator.Instance.CallHiveService<IEnumerable<Job>>(s => s.GetJobs()); 97 97 98 foreach (var j in jobsLoaded) { 99 jobs.Add(new RefreshableJob(j)); 100 } 101 } 102 catch { 98 try { 99 foreach (var j in jobsLoaded) { 100 jobs.Add(new RefreshableJob(j)); 101 } 102 } catch (NullReferenceException) { 103 // jobs was set to null during ClearHiveClient 104 } 105 } catch { 103 106 jobs = null; 104 107 throw; 105 } 106 finally { 108 } finally { 107 109 OnRefreshed(); 108 110 } 109 }110 111 public void RefreshAsync(Action<Exception> exceptionCallback) {112 var call = new Func<Exception>(delegate() {113 try {114 Refresh();115 }116 catch (Exception ex) {117 return ex;118 }119 return null;120 });121 call.BeginInvoke(delegate(IAsyncResult result) {122 Exception ex = call.EndInvoke(result);123 if (ex != null) exceptionCallback(ex);124 }, null);125 111 } 126 112 #endregion … … 146 132 } 147 133 public static void StoreAsync(Action<Exception> exceptionCallback, IHiveItem item, CancellationToken cancellationToken) { 148 var call = new Func<Exception>(delegate () {134 var call = new Func<Exception>(delegate () { 149 135 try { 150 136 Store(item, cancellationToken); 151 } 152 catch (Exception ex) { 137 } catch (Exception ex) { 153 138 return ex; 154 139 } 155 140 return null; 156 141 }); 157 call.BeginInvoke(delegate (IAsyncResult result) {142 call.BeginInvoke(delegate (IAsyncResult result) { 158 143 Exception ex = call.EndInvoke(result); 159 144 if (ex != null) exceptionCallback(ex); … … 294 279 } 295 280 TS.Task.WaitAll(tasks.ToArray()); 296 } 297 finally { 281 } finally { 298 282 refreshableJob.Job.Modified = false; 299 283 refreshableJob.IsProgressing = false; … … 394 378 taskUploadSemaphore.Release(); semaphoreReleased = true; // the semaphore has to be release before waitall! 395 379 TS.Task.WaitAll(tasks.ToArray()); 396 } 397 finally { 380 } finally { 398 381 if (!semaphoreReleased) taskUploadSemaphore.Release(); 399 382 } … … 441 424 if (refreshableJob.IsFinished()) { 442 425 refreshableJob.ExecutionState = Core.ExecutionState.Stopped; 426 } else if (refreshableJob.IsPaused()) { 427 refreshableJob.ExecutionState = Core.ExecutionState.Paused; 443 428 } else { 444 429 refreshableJob.ExecutionState = Core.ExecutionState.Started; 445 430 } 446 431 refreshableJob.OnLoaded(); 447 } 448 finally { 432 } finally { 449 433 refreshableJob.IsProgressing = false; 450 434 refreshableJob.Progress.Finish(); … … 483 467 try { 484 468 return PersistenceUtil.Deserialize<ItemTask>(taskData.Data); 485 } 486 catch { 469 } catch { 487 470 return null; 488 471 } … … 495 478 public static void TryAndRepeat(Action action, int repetitions, string errorMessage, ILog log = null) { 496 479 while (true) { 497 try { action(); return; } 498 catch (Exception e) { 480 try { action(); return; } catch (Exception e) { 499 481 if (repetitions == 0) throw new HiveException(errorMessage, e); 500 482 if (log != null) log.LogMessage(string.Format("{0}: {1} - will try again!", errorMessage, e.ToString()));
Note: See TracChangeset
for help on using the changeset viewer.