From 338132101982c854ec5dba3fceae51f638786c66 Mon Sep 17 00:00:00 2001
From: Nelson Tavares de Sousa <ntd@informatik.uni-kiel.de>
Date: Thu, 11 Dec 2014 14:13:09 +0100
Subject: [PATCH] renamed method

---
 src/main/java/teetime/framework/Stage.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/main/java/teetime/framework/Stage.java b/src/main/java/teetime/framework/Stage.java
index 04530428..a70b94f6 100644
--- a/src/main/java/teetime/framework/Stage.java
+++ b/src/main/java/teetime/framework/Stage.java
@@ -1,8 +1,8 @@
 package teetime.framework;
 
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -13,14 +13,14 @@ import teetime.framework.validation.InvalidPortConnection;
 public abstract class Stage {
 
 	private final String id;
-	private final static Map<String, Integer> instancesCounter = new HashMap<String, Integer>();
+	private static final Map<String, Integer> INSTANCES_COUNTER = new ConcurrentHashMap<String, Integer>();
 	/**
 	 * A unique logger instance per stage instance
 	 */
-	protected final Logger logger; // NOPMD
+	protected final Logger logger;
 
 	protected Stage() {
-		this.id = this.nameInstance();
+		this.id = this.createId();
 		this.logger = LoggerFactory.getLogger(this.getClass().getName() + "-" + this.id);
 	}
 
@@ -33,17 +33,17 @@ public abstract class Stage {
 		return this.getClass().getName() + ": " + this.getId();
 	}
 
-	private String nameInstance() {
+	private String createId() {
 		int instances = 0;
 		String id;
 		String simpleName = this.getClass().getSimpleName();
 
-		if (instancesCounter.containsKey(simpleName)) {
-			instances = instancesCounter.get(simpleName);
+		if (INSTANCES_COUNTER.containsKey(simpleName)) {
+			instances = INSTANCES_COUNTER.get(simpleName);
 		}
 
 		id = simpleName + "-" + instances;
-		instancesCounter.put(simpleName, ++instances);
+		INSTANCES_COUNTER.put(simpleName, ++instances);
 		return id;
 	}
 
-- 
GitLab