- Timestamp:
- 05/04/17 17:19:35 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceReintegration/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r14901 r14927 99 99 jobs.Add(new RefreshableJob(j)); 100 100 } 101 } 102 catch { 101 } catch { 103 102 jobs = null; 104 103 throw; 105 } 106 finally { 104 } finally { 107 105 OnRefreshed(); 108 106 } … … 110 108 111 109 public void RefreshAsync(Action<Exception> exceptionCallback) { 112 var call = new Func<Exception>(delegate () {110 var call = new Func<Exception>(delegate () { 113 111 try { 114 112 Refresh(); 115 } 116 catch (Exception ex) { 113 } catch (Exception ex) { 117 114 return ex; 118 115 } 119 116 return null; 120 117 }); 121 call.BeginInvoke(delegate (IAsyncResult result) {118 call.BeginInvoke(delegate (IAsyncResult result) { 122 119 Exception ex = call.EndInvoke(result); 123 120 if (ex != null) exceptionCallback(ex); … … 146 143 } 147 144 public static void StoreAsync(Action<Exception> exceptionCallback, IHiveItem item, CancellationToken cancellationToken) { 148 var call = new Func<Exception>(delegate () {145 var call = new Func<Exception>(delegate () { 149 146 try { 150 147 Store(item, cancellationToken); 151 } 152 catch (Exception ex) { 148 } catch (Exception ex) { 153 149 return ex; 154 150 } 155 151 return null; 156 152 }); 157 call.BeginInvoke(delegate (IAsyncResult result) {153 call.BeginInvoke(delegate (IAsyncResult result) { 158 154 Exception ex = call.EndInvoke(result); 159 155 if (ex != null) exceptionCallback(ex); … … 294 290 } 295 291 TS.Task.WaitAll(tasks.ToArray()); 296 } 297 finally { 292 } finally { 298 293 refreshableJob.Job.Modified = false; 299 294 refreshableJob.IsProgressing = false; … … 394 389 taskUploadSemaphore.Release(); semaphoreReleased = true; // the semaphore has to be release before waitall! 395 390 TS.Task.WaitAll(tasks.ToArray()); 396 } 397 finally { 391 } finally { 398 392 if (!semaphoreReleased) taskUploadSemaphore.Release(); 399 393 } … … 443 437 } else if (refreshableJob.IsPaused()) { 444 438 refreshableJob.ExecutionState = Core.ExecutionState.Paused; 445 } else { 439 } else { 446 440 refreshableJob.ExecutionState = Core.ExecutionState.Started; 447 441 } 448 442 refreshableJob.OnLoaded(); 449 } 450 finally { 443 } finally { 451 444 refreshableJob.IsProgressing = false; 452 445 refreshableJob.Progress.Finish(); … … 485 478 try { 486 479 return PersistenceUtil.Deserialize<ItemTask>(taskData.Data); 487 } 488 catch { 480 } catch { 489 481 return null; 490 482 } … … 497 489 public static void TryAndRepeat(Action action, int repetitions, string errorMessage, ILog log = null) { 498 490 while (true) { 499 try { action(); return; } 500 catch (Exception e) { 491 try { action(); return; } catch (Exception e) { 501 492 if (repetitions == 0) throw new HiveException(errorMessage, e); 502 493 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.