Changeset 9526 for branches/HiveStatistics/sources
- Timestamp:
- 05/24/13 14:45:51 (12 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.JanitorService/3.3/JanitorService.cs
r7259 r9526 26 26 public partial class JanitorService : ServiceBase { 27 27 private HiveJanitor janitor; 28 private Thread janitorThread; 28 private Thread janitorCleanupThread; 29 private Thread janitorGenerateStatisticsThread; 29 30 30 31 public JanitorService() { … … 35 36 janitor = new HiveJanitor(); 36 37 37 janitorThread = new Thread(janitor.Run); 38 janitorThread.IsBackground = true; //dont keep app alive 39 janitorThread.Start(); 38 janitorCleanupThread = new Thread(janitor.RunCleanup) { 39 IsBackground = true 40 }; 41 janitorGenerateStatisticsThread = new Thread(janitor.RunGenerateStatistics) { 42 IsBackground = true 43 }; 44 45 janitorCleanupThread.Start(); 46 janitorGenerateStatisticsThread.Start(); 40 47 } 41 48 42 49 protected override void OnStop() { 43 50 janitor.StopJanitor(); 44 janitorThread.Join(); 51 janitorCleanupThread.Join(); 52 janitorGenerateStatisticsThread.Join(); 45 53 } 46 54 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/HeuristicLab.Services.Hive-3.3.csproj
r9434 r9526 137 137 <Compile Include="DataTransfer\Statistics.cs" /> 138 138 <Compile Include="DataTransfer\UserStatistics.cs" /> 139 <Compile Include="HiveStatisticsGenerator.cs" /> 140 <Compile Include="Interfaces\IStatisticsGenerator.cs" /> 139 141 <Compile Include="OptimizedHiveDao.cs" /> 140 142 <Compile Include="HiveDao.cs" /> -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/HiveJanitor.cs
r9434 r9526 27 27 public class HiveJanitor { 28 28 private bool stop; 29 private AutoResetEvent waitHandle; 29 private AutoResetEvent cleanupWaitHandle; 30 private AutoResetEvent generateStatisticsWaitHandle; 30 31 31 32 private DataAccess.ITransactionManager trans { … … 37 38 } 38 39 40 private IStatisticsGenerator statisticsGenerator { 41 get { return ServiceLocator.Instance.StatisticsGenerator; } 42 } 43 39 44 private IHiveDao dao { 40 45 get { return ServiceLocator.Instance.HiveDao; } … … 43 48 public HiveJanitor() { 44 49 stop = false; 45 waitHandle = new AutoResetEvent(true); 50 cleanupWaitHandle = new AutoResetEvent(true); 51 generateStatisticsWaitHandle = new AutoResetEvent(true); 46 52 } 47 53 48 54 public void StopJanitor() { 49 55 stop = true; 50 waitHandle.Set();56 cleanupWaitHandle.Set(); 51 57 } 52 58 53 public void Run () {59 public void RunCleanup() { 54 60 while (!stop) { 55 61 try { … … 72 78 LogFactory.GetLogger(typeof(HiveJanitor).Namespace).Log(string.Format("HiveJanitor: The following exception occured: {0}", e.ToString())); 73 79 } 74 waitHandle.WaitOne(HeuristicLab.Services.Hive.Properties.Settings.Default.CleanupInterval);80 cleanupWaitHandle.WaitOne(HeuristicLab.Services.Hive.Properties.Settings.Default.CleanupInterval); 75 81 } 76 waitHandle.Close(); 82 cleanupWaitHandle.Close(); 83 } 84 85 public void RunGenerateStatistics() { 86 while (!stop) { 87 try { 88 LogFactory.GetLogger(typeof(HiveJanitor).Namespace).Log("HiveJanitor: starting generate statistics"); 89 statisticsGenerator.GenerateStatistics(); 90 LogFactory.GetLogger(typeof(HiveJanitor).Namespace).Log("HiveJanitor: generate statistics finished"); 91 } 92 catch (Exception e) { 93 LogFactory.GetLogger(typeof(HiveJanitor).Namespace).Log(string.Format("HiveJanitor: The following exception occured: {0}", e)); 94 } 95 96 generateStatisticsWaitHandle.WaitOne(Properties.Settings.Default.GenerateStatisticsInterval); 97 } 98 99 generateStatisticsWaitHandle.Close(); 77 100 } 78 101 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/Interfaces/IServiceLocator.cs
r9434 r9526 29 29 IOptimizedHiveDao OptimizedHiveDao { get; } 30 30 IEventManager EventManager { get; } 31 IStatisticsGenerator StatisticsGenerator { get; } 31 32 ITransactionManager TransactionManager { get; } 32 33 Access.IUserManager UserManager { get; } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/Properties/Settings.Designer.cs
r9123 r9526 2 2 // <auto-generated> 3 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319.1 79294 // Runtime Version:4.0.30319.18034 5 5 // 6 6 // Changes to this file may cause incorrect behavior and will be lost if … … 86 86 } 87 87 } 88 89 [global::System.Configuration.ApplicationScopedSettingAttribute()] 90 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 91 [global::System.Configuration.DefaultSettingValueAttribute("00:05:00")] 92 public global::System.TimeSpan GenerateStatisticsInterval { 93 get { 94 return ((global::System.TimeSpan)(this["GenerateStatisticsInterval"])); 95 } 96 } 88 97 } 89 98 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/Properties/Settings.settings
r9123 r9526 24 24 <Value Profile="(Default)">00:00:20</Value> 25 25 </Setting> 26 <Setting Name="GenerateStatisticsInterval" Type="System.TimeSpan" Scope="Application"> 27 <Value Profile="(Default)">00:05:00</Value> 28 </Setting> 26 29 </Settings> 27 30 </SettingsFile> -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/ServiceLocator.cs
r9434 r9526 74 74 } 75 75 76 private IStatisticsGenerator statisticsGenerator; 77 public IStatisticsGenerator StatisticsGenerator { 78 get { return statisticsGenerator ?? (statisticsGenerator = new HiveStatisticsGenerator()); } 79 } 80 76 81 private ITransactionManager transactionManager; 77 82 public ITransactionManager TransactionManager { -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/app.config
r9123 r9526 29 29 <value>00:00:20</value> 30 30 </setting> 31 <setting name="GenerateStatisticsInterval" serializeAs="String"> 32 <value>00:05:00</value> 33 </setting> 31 34 </HeuristicLab.Services.Hive.Properties.Settings> 32 35 </applicationSettings>
Note: See TracChangeset
for help on using the changeset viewer.