Ignore:
Timestamp:
07/21/15 11:48:49 (7 years ago)
Author:
dglaser
Message:

#2388:

HeuristicLab.Services.Access.DataAccess-3.3:

  • Added a new method to the TaskDao

HeuristicLab.Services.Hive-3.3:

  • Added NewEventManager.cs
  • Updated HiveJanitor.cs
  • Updated ServiceLocator.cs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/HiveJanitor.cs

    r12484 r12789  
    3131    private AutoResetEvent generateStatisticsWaitHandle;
    3232
    33     private ITransactionManager trans {
    34       get { return ServiceLocator.Instance.TransactionManager; }
     33    private IPersistenceManager PersistenceManager {
     34      get { return ServiceLocator.Instance.PersistenceManager; }
    3535    }
    36 
    37     private IEventManager eventManager {
     36    private IEventManager EventManager {
    3837      get { return ServiceLocator.Instance.EventManager; }
    3938    }
    4039
    41     private IStatisticsGenerator statisticsGenerator {
     40    private IStatisticsGenerator StatisticsGenerator {
    4241      get { return ServiceLocator.Instance.StatisticsGenerator; }
    43     }
    44 
    45     private IHiveDao dao {
    46       get { return ServiceLocator.Instance.HiveDao; }
    4742    }
    4843
     
    6459          LogFactory.GetLogger(typeof(HiveJanitor).Namespace).Log("HiveJanitor: starting cleanup.");
    6560          bool cleanup = false;
    66           trans.UseTransaction(() => {
    67             DateTime lastCleanup = dao.GetLastCleanup();
    68             if (DateTime.Now - lastCleanup > HeuristicLab.Services.Hive.Properties.Settings.Default.CleanupInterval) {
    69               dao.SetLastCleanup(DateTime.Now);
    70               cleanup = true;
    71             }
    72           }, true);
    73 
     61          using (var pm = PersistenceManager) {
     62            var lifecycleDao = pm.LifecycleDao;
     63            pm.UseTransaction(() => {
     64              var lifecycle = lifecycleDao.GetLastLifecycle();
     65              if (lifecycle == null
     66                  || DateTime.Now - lifecycle.LastCleanup > HeuristicLab.Services.Hive.Properties.Settings.Default.CleanupInterval) {
     67                lifecycleDao.UpdateLifecycle();
     68                cleanup = true;
     69              }
     70              pm.SubmitChanges();
     71            }, true);
     72          }
    7473          if (cleanup) {
    75             eventManager.Cleanup();
     74            EventManager.Cleanup();
    7675          }
    7776          LogFactory.GetLogger(typeof(HiveJanitor).Namespace).Log("HiveJanitor: cleanup finished.");
     
    8988        try {
    9089          LogFactory.GetLogger(typeof(HiveJanitor).Namespace).Log("HiveJanitor: starting generate statistics.");
    91           statisticsGenerator.GenerateStatistics();
     90          StatisticsGenerator.GenerateStatistics();
    9291          LogFactory.GetLogger(typeof(HiveJanitor).Namespace).Log("HiveJanitor: generate statistics finished.");
    9392        }
Note: See TracChangeset for help on using the changeset viewer.