Changeset 4121 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Console/3.3
- Timestamp:
- 07/30/10 13:56:28 (14 years ago)
- Location:
- branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Console/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Console/3.3/HeuristicLab.Hive.Server.Console-3.3.csproj
r4107 r4121 43 43 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> 44 44 <DebugSymbols>true</DebugSymbols> 45 <OutputPath>bin\ x86\Debug\</OutputPath>45 <OutputPath>bin\Debug\</OutputPath> 46 46 <DefineConstants>DEBUG;TRACE</DefineConstants> 47 47 <DebugType>full</DebugType> -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Console/3.3/JobDataFetcher.cs
r4120 r4121 8 8 using System.Collections; 9 9 using System.Threading; 10 using HeuristicLab.Hive.Contracts.Interfaces; 10 11 11 12 namespace HeuristicLab.Hive.Server.ServerConsole { … … 15 16 public IEnumerable<State> PollStates { 16 17 get { return pollStates; } 17 } 18 } 18 19 19 20 public event EventHandler NewDataAvailable; … … 24 25 25 26 public List<JobDto> CachedJobs { get; set; } 27 28 private IJobManager jobManager; 26 29 27 30 public double Interval { … … 36 39 } 37 40 set { 38 Console.WriteLine("Setting for " + PollStates + " changed to: " + value); 39 _nrOfEntriesOnPage = value; 41 Console.WriteLine("Setting for " + PollStates + " changed to: " + value); 42 _nrOfEntriesOnPage = value; 40 43 Thread t = new Thread(new ThreadStart(DoUpdateRun)); 41 t.Start(); 44 t.Start(); 42 45 } 43 } 46 } 44 47 public int CurrentPage { get; set; } 45 48 … … 50 53 CurrentPage = 0; 51 54 pollStates.AddRange(states); 55 jobManager = ServiceLocator.GetJobManager(); 52 56 timer = new System.Timers.Timer(); 53 57 timer.Interval = 5000; 54 timer.Elapsed += new ElapsedEventHandler(Timer_Elapsed); 58 timer.Elapsed += new ElapsedEventHandler(Timer_Elapsed); 55 59 } 56 60 … … 67 71 CurrentPage--; 68 72 DoUpdateRun(); 69 } 73 } 70 74 71 75 private void Timer_Elapsed(object sender, ElapsedEventArgs e) { … … 77 81 // todo: make access to PollStates thread-safe! 78 82 // * added lock on locker -> didn't help 79 // * made public property PollStates an IEnumerable to be immutable -> lets see 80 lock (locker) { 81 foreach (State stat in PollStates) { 82 ResponseList<JobDto> resList = ServiceLocator.GetJobManager().GetAllJobsWithFilter(stat, CurrentPage * NrOfEntriesOnPage, 83 NrOfEntriesOnPage); 84 if (resList.Success) { 85 if (resList.List.Count == 0) { 86 if (CurrentPage > 0) { 87 CurrentPage--; 88 } 89 } else { 90 CachedJobs = new List<JobDto>(); 91 CachedJobs.AddRange(resList.List); 83 // * made public property PollStates an IEnumerable to be immutable -> didn't help 84 // * using for loop 85 86 State[] pollStatesCopy = PollStates.ToArray(); 87 for (int i = 0; i < pollStatesCopy.Length; i++) { 88 ResponseList<JobDto> resList = jobManager.GetAllJobsWithFilter(pollStatesCopy[i], CurrentPage * NrOfEntriesOnPage, NrOfEntriesOnPage); 89 if (resList.Success) { 90 if (resList.List.Count == 0) { 91 if (CurrentPage > 0) { 92 CurrentPage--; 92 93 } 94 } else { 95 CachedJobs = new List<JobDto>(); 96 CachedJobs.AddRange(resList.List); 93 97 } 94 98 } 95 if (NewDataAvailable != null) 96 NewDataAvailable(this, new EventArgs()); 99 } 100 if (NewDataAvailable != null) { 101 NewDataAvailable(this, new EventArgs()); 97 102 } 98 103 }
Note: See TracChangeset
for help on using the changeset viewer.