Index: branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Status/3.3/WebApi/DataController.cs
===================================================================
--- branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Status/3.3/WebApi/DataController.cs	(revision 12843)
+++ branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Status/3.3/WebApi/DataController.cs	(revision 12858)
@@ -99,53 +99,52 @@
 
     public DT.Status GetStatus() {
-      using (var pm = PersistenceManager) {
-        var slaveDao = pm.SlaveDao;
-        var onlineSlaves = pm.UseTransaction(() => slaveDao.GetOnlineSlaves().ToList());
-        var activeSlaves = onlineSlaves.Where(s => s.IsAllowedToCalculate).ToList();
-        var calculatingSlaves = activeSlaves.Where(s => s.SlaveState == SlaveState.Calculating).ToList();
-        int totalCores = onlineSlaves.Sum(s => s.Cores ?? 0);
-        int totalMemory = onlineSlaves.Sum(s => s.Memory ?? 0);
-        return new DT.Status {
-          CoreStatus = new DT.CoreStatus {
-            TotalCores = totalCores,
-            UsedCores = totalCores - onlineSlaves.Sum(s => s.FreeCores ?? 0),
-            ActiveCores = activeSlaves.Sum(s => s.Cores ?? 0),
-            CalculatingCores = calculatingSlaves.Sum(s => s.Cores ?? 0) - calculatingSlaves.Sum(s => s.FreeCores ?? 0)
+      var pm = PersistenceManager;
+      var slaveDao = pm.SlaveDao;
+      var onlineSlaves = pm.UseTransaction(() => slaveDao.GetOnlineSlaves().ToList());
+      var activeSlaves = onlineSlaves.Where(s => s.IsAllowedToCalculate).ToList();
+      var calculatingSlaves = activeSlaves.Where(s => s.SlaveState == SlaveState.Calculating).ToList();
+      int totalCores = onlineSlaves.Sum(s => s.Cores ?? 0);
+      int totalMemory = onlineSlaves.Sum(s => s.Memory ?? 0);
+      return new DT.Status {
+        CoreStatus = new DT.CoreStatus {
+          TotalCores = totalCores,
+          UsedCores = totalCores - onlineSlaves.Sum(s => s.FreeCores ?? 0),
+          ActiveCores = activeSlaves.Sum(s => s.Cores ?? 0),
+          CalculatingCores = calculatingSlaves.Sum(s => s.Cores ?? 0) - calculatingSlaves.Sum(s => s.FreeCores ?? 0)
+        },
+        CpuUtilizationStatus = new DT.CpuUtilizationStatus {
+          TotalCpuUtilization = onlineSlaves.Any()
+                                ? Math.Round(onlineSlaves.Average(s => s.CpuUtilization), 2)
+                                : 0.0,
+          ActiveCpuUtilization = activeSlaves.Any()
+                                 ? Math.Round(activeSlaves.Average(s => s.CpuUtilization), 2)
+                                 : 0.0,
+          CalculatingCpuUtilization = calculatingSlaves.Any()
+                                      ? Math.Round(calculatingSlaves.Average(s => s.CpuUtilization), 2)
+                                      : 0.0
+        },
+        MemoryStatus = new DT.MemoryStatus {
+          TotalMemory = totalMemory,
+          UsedMemory = totalMemory - onlineSlaves.Sum(s => s.FreeMemory ?? 0),
+          ActiveMemory = activeSlaves.Sum(s => s.Memory ?? 0),
+          CalculatingMemory = calculatingSlaves.Sum(s => s.Memory ?? 0) - calculatingSlaves.Sum(s => s.FreeMemory ?? 0)
+        },
+        TimeStatus = GetTimeStatus(pm),
+        TasksStatus = GetTaskStatus(pm),
+        SlavesStatus = onlineSlaves.Select(x => new DT.SlaveStatus {
+          Slave = new DT.Slave {
+            Id = x.ResourceId.ToString(),
+            Name = x.Name
           },
-          CpuUtilizationStatus = new DT.CpuUtilizationStatus {
-            TotalCpuUtilization = onlineSlaves.Any()
-                                  ? Math.Round(onlineSlaves.Average(s => s.CpuUtilization), 2)
-                                  : 0.0,
-            ActiveCpuUtilization = activeSlaves.Any()
-                                   ? Math.Round(activeSlaves.Average(s => s.CpuUtilization), 2)
-                                   : 0.0,
-            CalculatingCpuUtilization = calculatingSlaves.Any()
-                                        ? Math.Round(calculatingSlaves.Average(s => s.CpuUtilization), 2)
-                                        : 0.0
-          },
-          MemoryStatus = new DT.MemoryStatus {
-            TotalMemory = totalMemory,
-            UsedMemory = totalMemory - onlineSlaves.Sum(s => s.FreeMemory ?? 0),
-            ActiveMemory = activeSlaves.Sum(s => s.Memory ?? 0),
-            CalculatingMemory = calculatingSlaves.Sum(s => s.Memory ?? 0) - calculatingSlaves.Sum(s => s.FreeMemory ?? 0)
-          },
-          TimeStatus = GetTimeStatus(pm),
-          TasksStatus = GetTaskStatus(pm),
-          SlavesStatus = onlineSlaves.Select(x => new DT.SlaveStatus {
-            Slave = new DT.Slave {
-              Id = x.ResourceId.ToString(),
-              Name = x.Name
-            },
-            CpuUtilization = x.CpuUtilization,
-            Cores = x.Cores ?? 0,
-            FreeCores = x.FreeCores ?? 0,
-            Memory = x.Memory ?? 0,
-            FreeMemory = x.FreeMemory ?? 0,
-            IsAllowedToCalculate = x.IsAllowedToCalculate,
-            State = x.SlaveState.ToString()
-          }).OrderBy(x => x.Slave.Name),
-          Timestamp = JavascriptUtils.ToTimestamp(DateTime.Now)
-        };
-      }
+          CpuUtilization = x.CpuUtilization,
+          Cores = x.Cores ?? 0,
+          FreeCores = x.FreeCores ?? 0,
+          Memory = x.Memory ?? 0,
+          FreeMemory = x.FreeMemory ?? 0,
+          IsAllowedToCalculate = x.IsAllowedToCalculate,
+          State = x.SlaveState.ToString()
+        }).OrderBy(x => x.Slave.Name),
+        Timestamp = JavascriptUtils.ToTimestamp(DateTime.Now)
+      };
     }
 
@@ -158,56 +157,55 @@
         increment += 5;
       }
-      using (var pm = PersistenceManager) {
-        var factClientInfoDao = pm.FactClientInfoDao;
-        var clientInfos = pm.UseTransaction(() => {
-          return factClientInfoDao.GetAll()
-            .Where(s => s.Time >= start
-                        && s.Time <= end
-                        && s.SlaveState != SlaveState.Offline)
-            .OrderBy(s => s.Time)
-            .GroupBy(s => s.Time)
-            .Select(x => new {
-              Timestamp = x.Key,
-              TotalCores = x.Sum(y => y.NumTotalCores),
-              UsedCores = x.Sum(y => y.NumUsedCores),
-              TotalMemory = x.Sum(y => y.TotalMemory),
-              UsedMemory = x.Sum(y => y.UsedMemory),
-              CpuUtilization = x.Where(y => y.IsAllowedToCalculate).Average(y => y.CpuUtilization)
-            })
-            .ToList();
-        });
-        var statusList = new List<DT.Status>();
-        var e = clientInfos.GetEnumerator();
-        do {
-          var status = new DT.Status {
-            CoreStatus = new DT.CoreStatus(),
-            CpuUtilizationStatus = new DT.CpuUtilizationStatus(),
-            MemoryStatus = new DT.MemoryStatus()
-          };
-          int i = 0;
-          DateTime lastTimestamp = DateTime.Now;
-          while (e.MoveNext()) {
-            var clientInfo = e.Current;
-            status.CoreStatus.TotalCores += clientInfo.TotalCores;
-            status.CoreStatus.UsedCores += clientInfo.UsedCores;
-            status.MemoryStatus.TotalMemory += clientInfo.TotalMemory;
-            status.MemoryStatus.UsedMemory += clientInfo.UsedMemory;
-            status.CpuUtilizationStatus.TotalCpuUtilization += clientInfo.CpuUtilization;
-            lastTimestamp = clientInfo.Timestamp;
-            i++;
-            if (i >= increment)
-              break;
-          }
-          if (i <= 0) continue;
-          status.Timestamp = JavascriptUtils.ToTimestamp(lastTimestamp);
-          status.CoreStatus.TotalCores /= i;
-          status.CoreStatus.UsedCores /= i;
-          status.MemoryStatus.TotalMemory /= i;
-          status.MemoryStatus.UsedMemory /= i;
-          status.CpuUtilizationStatus.TotalCpuUtilization /= i;
-          statusList.Add(status);
-        } while (e.Current != null);
-        return statusList;
-      }
+      var pm = PersistenceManager;
+      var factClientInfoDao = pm.FactClientInfoDao;
+      var clientInfos = pm.UseTransaction(() => {
+        return factClientInfoDao.GetAll()
+          .Where(s => s.Time >= start
+                      && s.Time <= end
+                      && s.SlaveState != SlaveState.Offline)
+          .OrderBy(s => s.Time)
+          .GroupBy(s => s.Time)
+          .Select(x => new {
+            Timestamp = x.Key,
+            TotalCores = x.Sum(y => y.NumTotalCores),
+            UsedCores = x.Sum(y => y.NumUsedCores),
+            TotalMemory = x.Sum(y => y.TotalMemory),
+            UsedMemory = x.Sum(y => y.UsedMemory),
+            CpuUtilization = x.Where(y => y.IsAllowedToCalculate).Average(y => y.CpuUtilization)
+          })
+          .ToList();
+      });
+      var statusList = new List<DT.Status>();
+      var e = clientInfos.GetEnumerator();
+      do {
+        var status = new DT.Status {
+          CoreStatus = new DT.CoreStatus(),
+          CpuUtilizationStatus = new DT.CpuUtilizationStatus(),
+          MemoryStatus = new DT.MemoryStatus()
+        };
+        int i = 0;
+        DateTime lastTimestamp = DateTime.Now;
+        while (e.MoveNext()) {
+          var clientInfo = e.Current;
+          status.CoreStatus.TotalCores += clientInfo.TotalCores;
+          status.CoreStatus.UsedCores += clientInfo.UsedCores;
+          status.MemoryStatus.TotalMemory += clientInfo.TotalMemory;
+          status.MemoryStatus.UsedMemory += clientInfo.UsedMemory;
+          status.CpuUtilizationStatus.TotalCpuUtilization += clientInfo.CpuUtilization;
+          lastTimestamp = clientInfo.Timestamp;
+          i++;
+          if (i >= increment)
+            break;
+        }
+        if (i <= 0) continue;
+        status.Timestamp = JavascriptUtils.ToTimestamp(lastTimestamp);
+        status.CoreStatus.TotalCores /= i;
+        status.CoreStatus.UsedCores /= i;
+        status.MemoryStatus.TotalMemory /= i;
+        status.MemoryStatus.UsedMemory /= i;
+        status.CpuUtilizationStatus.TotalCpuUtilization /= i;
+        statusList.Add(status);
+      } while (e.Current != null);
+      return statusList;
     }
 
