Index: /trunk/sources/HeuristicLab.CEDMA.DB/Database.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.DB/Database.cs	(revision 407)
+++ /trunk/sources/HeuristicLab.CEDMA.DB/Database.cs	(revision 408)
@@ -36,15 +36,13 @@
   public class Database : IDatabase {
     private string connectionString;
-    private ReaderWriterLockSlim agentLock;
-    private ReaderWriterLockSlim resultLock;
+    private ReaderWriterLockSlim rwLock;
     public Database(string connectionString) {
       this.connectionString = connectionString;
-      agentLock = new ReaderWriterLockSlim();
-      resultLock = new ReaderWriterLockSlim();
+      rwLock = new ReaderWriterLockSlim();
     }
 
     #region create empty database
     public void CreateNew() {
-      agentLock.EnterWriteLock();
+      rwLock.EnterWriteLock();
       try {
         using(DbConnection cnn = new SQLiteConnection(connectionString)) {
@@ -70,5 +68,5 @@
         }
       } finally {
-        agentLock.ExitWriteLock();
+        rwLock.ExitWriteLock();
       }
     }
@@ -77,5 +75,5 @@
     #region insert agent/result/sub-result
     public long InsertAgent(long? parentAgentId, string name, byte[] rawData) {
-      agentLock.EnterWriteLock();
+      rwLock.EnterWriteLock();
       try {
         using(DbConnection cnn = new SQLiteConnection(connectionString)) {
@@ -109,10 +107,10 @@
         }
       } finally {
-        agentLock.ExitWriteLock();
+        rwLock.ExitWriteLock();
       }
     }
 
     public long InsertResult(long agentId, string summary, string description, byte[] rawData) {
-      resultLock.EnterWriteLock();
+      rwLock.EnterWriteLock();
       try {
         using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) {
@@ -151,10 +149,10 @@
         }
       } finally {
-        resultLock.ExitWriteLock();
+        rwLock.ExitWriteLock();
       }
     }
 
     public long InsertSubResult(long resultId, string summary, string description, byte[] rawData) {
-      resultLock.EnterWriteLock();
+      rwLock.EnterWriteLock();
       try {
         using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) {
@@ -193,5 +191,5 @@
         }
       } finally {
-        resultLock.ExitWriteLock();
+        rwLock.ExitWriteLock();
       }
     }
@@ -200,5 +198,5 @@
     #region update agent/run
     public void UpdateAgent(long id, string name) {
-      agentLock.EnterWriteLock();
+      rwLock.EnterWriteLock();
       try {
         using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) {
@@ -222,10 +220,10 @@
         }
       } finally {
-        agentLock.ExitWriteLock();
+        rwLock.ExitWriteLock();
       }
     }
 
     public void UpdateAgent(long id, ProcessStatus status) {
-      agentLock.EnterWriteLock();
+      rwLock.EnterWriteLock();
       try {
         using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) {
@@ -249,10 +247,10 @@
         }
       } finally {
-        agentLock.ExitWriteLock();
+        rwLock.ExitWriteLock();
       }
     }
 
     public void UpdateAgent(long id, byte[] rawData) {
-      agentLock.EnterWriteLock();
+      rwLock.EnterWriteLock();
       try {
         using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) {
@@ -276,5 +274,5 @@
         }
       } finally {
-        agentLock.ExitWriteLock();
+        rwLock.ExitWriteLock();
       }
     }
@@ -285,5 +283,5 @@
 
     public ICollection<AgentEntry> GetAgents(ProcessStatus status) {
-      agentLock.EnterReadLock();
+      rwLock.EnterReadLock();
       List<AgentEntry> agents = new List<AgentEntry>();
       try {
@@ -308,5 +306,5 @@
         }
       } finally {
-        agentLock.ExitReadLock();
+        rwLock.ExitReadLock();
       }
       return agents;
@@ -314,5 +312,5 @@
 
     public ICollection<AgentEntry> GetAgents() {
-      agentLock.EnterReadLock();
+      rwLock.EnterReadLock();
       List<AgentEntry> agents = new List<AgentEntry>();
       try {
@@ -335,5 +333,5 @@
         }
       } finally {
-        agentLock.ExitReadLock();
+        rwLock.ExitReadLock();
       }
       return agents;
@@ -341,5 +339,5 @@
 
     public ICollection<AgentEntry> GetSubAgents(long parentAgentId) {
-      agentLock.EnterReadLock();
+      rwLock.EnterReadLock();
       List<AgentEntry> agents = new List<AgentEntry>();
       try {
@@ -367,5 +365,5 @@
         }
       } finally {
-        agentLock.ExitReadLock();
+        rwLock.ExitReadLock();
       }
       return agents;
@@ -374,5 +372,5 @@
     public ICollection<ResultEntry> GetResults(long agentId) {
       List<ResultEntry> results = new List<ResultEntry>();
-      resultLock.EnterReadLock();
+      rwLock.EnterReadLock();
       try {
         using(DbConnection cnn = new SQLiteConnection(connectionString)) {
@@ -399,5 +397,5 @@
         }
       } finally {
-        resultLock.ExitReadLock();
+        rwLock.ExitReadLock();
       }
       return results;
@@ -406,5 +404,5 @@
     public ICollection<ResultEntry> GetSubResults(long resultId) {
       List<ResultEntry> results = new List<ResultEntry>();
-      resultLock.EnterReadLock();
+      rwLock.EnterReadLock();
       try {
         using(DbConnection cnn = new SQLiteConnection(connectionString)) {
@@ -431,5 +429,5 @@
         }
       } finally {
-        resultLock.ExitReadLock();
+        rwLock.ExitReadLock();
       }
       return results;
