From f5209b37702a267abbe46074477b77ae1f03b915 Mon Sep 17 00:00:00 2001
From: Christian Wulf <chw@informatik.uni-kiel.de>
Date: Fri, 24 Jul 2015 21:29:28 +0200
Subject: [PATCH] added potential performance improvement

---
 .project                                                   | 6 ------
 src/main/java/teetime/framework/AbstractRunnableStage.java | 5 +++--
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/.project b/.project
index c3dde7d0..9c7a3eb0 100644
--- a/.project
+++ b/.project
@@ -25,17 +25,11 @@
 			<arguments>
 			</arguments>
 		</buildCommand>
-		<buildCommand>
-			<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
 	</buildSpec>
 	<natures>
 		<nature>org.eclipse.m2e.core.maven2Nature</nature>
 		<nature>org.eclipse.jdt.core.javanature</nature>
 		<nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
 		<nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
-		<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
 	</natures>
 </projectDescription>
diff --git a/src/main/java/teetime/framework/AbstractRunnableStage.java b/src/main/java/teetime/framework/AbstractRunnableStage.java
index 70890e3b..721354ca 100644
--- a/src/main/java/teetime/framework/AbstractRunnableStage.java
+++ b/src/main/java/teetime/framework/AbstractRunnableStage.java
@@ -39,6 +39,7 @@ abstract class AbstractRunnableStage implements Runnable {
 
 	@Override
 	public final void run() {
+		final Stage stage = this.stage; // should prevent the stage to be reloaded after a volatile read
 		this.logger.debug("Executing runnable stage...");
 
 		try {
@@ -49,7 +50,7 @@ abstract class AbstractRunnableStage implements Runnable {
 						executeStage();
 					} while (!stage.shouldBeTerminated());
 				} catch (StageException e) {
-					this.stage.terminate();
+					stage.terminate();
 					throw e;
 				} finally {
 					afterStageExecution();
@@ -67,7 +68,7 @@ abstract class AbstractRunnableStage implements Runnable {
 			}
 		}
 
-		logger.debug("Finished runnable stage. (" + this.stage.getId() + ")");
+		logger.debug("Finished runnable stage. (" + stage.getId() + ")");
 	}
 
 	protected abstract void beforeStageExecution() throws InterruptedException;
-- 
GitLab