Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs	(revision 5781)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs	(revision 5782)
@@ -23,4 +23,5 @@
 using System.Collections.Generic;
 using System.Linq;
+using System.Threading;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -35,4 +36,5 @@
     private bool wasJobAborted = false;
     public Core Core { get; set; }
+    private Semaphore pauseStopSem = new Semaphore(0, 1);
 
     private Exception currentException;
@@ -84,14 +86,34 @@
 
     public void Pause() {
-      Job.Pause();
-
+      if (Job == null) {
+        throw new InvalidStateException("Job is null");
+      }
+
+      if (Job.ExecutionState == HeuristicLab.Core.ExecutionState.Started) {
+        try {
+          Job.Pause();
+          //we need to block the pause...
+          pauseStopSem.WaitOne();
+        }
+        catch (Exception ex) {
+          SlaveClientCom.Instance.ClientCom.LogMessage("Error pausing job:" + ex.ToString());
+        }
+      }
     }
 
     public void Stop() {
+      if (Job == null) {
+        throw new InvalidStateException("Job is null");
+      }
       wasJobAborted = true;
+
       if ((ExecutionState == ExecutionState.Started) || (ExecutionState == ExecutionState.Paused)) {
-        Job.Stop();
-      } else {
-        Job_JobStopped(this, EventArgs.Empty);
+        try {
+          Job.Stop();
+          pauseStopSem.WaitOne();
+        }
+        catch (Exception ex) {
+          SlaveClientCom.Instance.ClientCom.LogMessage("Error stopping job:" + ex.ToString());
+        }
       }
     }
@@ -103,4 +125,5 @@
       Job.WaitForChildJobs += new EventHandler(Job_WaitForChildJobs);
       Job.DeleteChildJobs += new EventHandler(Job_DeleteChildJobs);
+      Job.JobPaused += new EventHandler(Job_JobPaused);
     }
 
@@ -111,4 +134,5 @@
       Job.WaitForChildJobs -= new EventHandler(Job_WaitForChildJobs);
       Job.DeleteChildJobs -= new EventHandler(Job_DeleteChildJobs);
+      Job.JobPaused -= new EventHandler(Job_JobPaused);
     }
 
@@ -159,6 +183,7 @@
     private void Job_JobStopped(object sender, EventArgs e) {
       if (wasJobAborted) {
-        Core.EnqueueExecutorMessage(Core.KillAppDomain, JobId);
+        pauseStopSem.Release();
       } else {
+        //it's a clean and finished job, so send it
         Core.EnqueueExecutorMessage(Core.SendFinishedJob, JobId);
       }
@@ -171,6 +196,12 @@
 
       if (Job.ExecutionState == HeuristicLab.Core.ExecutionState.Started) {
-        try { Job.Stop(); }
-        catch { }
+        try {
+          Job.Stop();
+          wasJobAborted = true;
+          pauseStopSem.WaitOne();
+        }
+        catch (Exception ex) {
+          SlaveClientCom.Instance.ClientCom.LogMessage("Error stopping job:" + ex.ToString());
+        }
       }
 
@@ -178,15 +209,14 @@
     }
 
+
     public JobData GetPausedJob() {
-      if (Job == null) {
-        throw new InvalidStateException("Job is null");
-      }
-
-      if (Job.ExecutionState == HeuristicLab.Core.ExecutionState.Started) {
-        try { Job.Pause(); }
-        catch { }
-      }
-
+      if (Job.ExecutionState != HeuristicLab.Core.ExecutionState.Paused) {
+        throw new Exception("Executor: Job has to be paused before fetching results.");
+      }
       return GetJob();
+    }
+
+    private void Job_JobPaused(object sender, EventArgs e) {
+      pauseStopSem.Release();
     }
 
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/Jobs/OptimizerJob.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/Jobs/OptimizerJob.cs	(revision 5781)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/Jobs/OptimizerJob.cs	(revision 5782)
@@ -154,5 +154,5 @@
     }
 
-    public void Pause() {
+    public virtual void Pause() {
       optimizer.Pause();
     }
@@ -173,5 +173,5 @@
 
     public event EventHandler JobPaused;
-    protected void OnJobPaused(object sender, EventArgs e) {
+    protected virtual void OnJobPaused() {
       EventHandler handler = JobPaused;
       if (handler != null) handler(this, EventArgs.Empty);
@@ -218,5 +218,5 @@
     protected virtual void RegisterEvents() {
       optimizer.Stopped += new EventHandler(optimizer_Stopped);
-      optimizer.Paused += new EventHandler(OnJobPaused);
+      optimizer.Paused += new EventHandler(optimizer_Paused);
       optimizer.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(optimizer_ExceptionOccurred);
       optimizer.DescriptionChanged += new EventHandler(optimizer_DescriptionChanged);
@@ -229,5 +229,5 @@
     protected virtual void DeregisterEvents() {
       optimizer.Stopped -= new EventHandler(optimizer_Stopped);
-      optimizer.Paused -= new EventHandler(OnJobPaused);
+      optimizer.Paused -= new EventHandler(optimizer_Paused);
       optimizer.ExceptionOccurred -= new EventHandler<EventArgs<Exception>>(optimizer_ExceptionOccurred);
       optimizer.DescriptionChanged -= this.DescriptionChanged;
@@ -265,4 +265,8 @@
       OnJobStopped();
     }
+
+    protected virtual void optimizer_Paused(object sender, EventArgs e) {
+      OnJobPaused();
+    }
     #endregion
 
