[jboss-cvs] JBoss Profiler SVN: r497 - branches/JBossProfiler2/src/main/org/jboss/profiler/shared.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Nov 16 20:41:06 EST 2008


Author: jesper.pedersen
Date: 2008-11-16 20:41:06 -0500 (Sun, 16 Nov 2008)
New Revision: 497

Modified:
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodRepository.java
Log:
Synchronzize getId() method

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodRepository.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodRepository.java	2008-11-16 20:01:00 UTC (rev 496)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodRepository.java	2008-11-17 01:41:06 UTC (rev 497)
@@ -68,14 +68,12 @@
    * @param methodName The method name
    * @return The method id
    */
-  public Integer getId(String className, String methodName) {
+  public synchronized Integer getId(String className, String methodName) {
     MethodInfo method = new MethodInfo(methodName, className);
     Integer hash = Integer.valueOf(method.hashCode());
 
-    MethodInfo value = methods.get(hash); 
-
-    if (value == null) {
-      value = methods.put(hash, method);
+    if (!methods.containsKey(hash)) {
+      methods.put(hash, method);
     }
 
     return hash;




More information about the jboss-cvs-commits mailing list