Author: tv
Date: Thu Nov 17 15:44:45 2016
New Revision: 1770221

URL: http://svn.apache.org/viewvc?rev=1770221&view=rev
Log:
Avoid explicit synchronization

Modified:
    
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ColumnMap.java
    
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/DatabaseMap.java
    
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/TableMap.java

Modified: 
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ColumnMap.java
URL: 
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ColumnMap.java?rev=1770221&r1=1770220&r2=1770221&view=diff
==============================================================================
--- 
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ColumnMap.java
 (original)
+++ 
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ColumnMap.java
 Thu Nov 17 15:44:45 2016
@@ -21,7 +21,6 @@ package org.apache.torque.map;
 
 import java.io.Serializable;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
@@ -415,16 +414,7 @@ public class ColumnMap extends OptionSup
     public InheritanceMap[] getInheritanceMaps()
     {
         InheritanceMap[] iMaps = new InheritanceMap[inheritanceMaps.size()];
-        synchronized (inheritanceMaps)
-        {
-            Iterator<InheritanceMap> it = inheritanceMaps.values().iterator();
-            int i = 0;
-            while (it.hasNext())
-            {
-                iMaps[i++] = it.next();
-            }
-        }
-        return iMaps;
+        return inheritanceMaps.values().toArray(iMaps);
     }
 
     /**

Modified: 
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/DatabaseMap.java
URL: 
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/DatabaseMap.java?rev=1770221&r1=1770220&r2=1770221&view=diff
==============================================================================
--- 
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/DatabaseMap.java
 (original)
+++ 
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/DatabaseMap.java
 Thu Nov 17 15:44:45 2016
@@ -23,7 +23,6 @@ import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.text.MessageFormat;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.StringTokenizer;
@@ -199,16 +198,8 @@ public class DatabaseMap extends OptionS
         {
             size++;
         }
-        TableMap[] dbTables = new TableMap[size];
-        synchronized (tables)
-        {
-            Iterator<TableMap> it = tables.values().iterator();
-            int i = 0;
-            while (it.hasNext())
-            {
-                dbTables[i++] = it.next();
-            }
-        }
+        TableMap[] dbTables = tables.values()
+                .toArray(new TableMap[size]);
         if (idTable != null)
         {
             dbTables[size - 1] = idTable;

Modified: 
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/TableMap.java
URL: 
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/TableMap.java?rev=1770221&r1=1770220&r2=1770221&view=diff
==============================================================================
--- 
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/TableMap.java
 (original)
+++ 
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/TableMap.java
 Thu Nov 17 15:44:45 2016
@@ -339,16 +339,9 @@ public class TableMap extends OptionSupp
      */
     public ColumnMap[] getColumns()
     {
-        ColumnMap[] tableColumns = new ColumnMap[columns.size()];
-        synchronized (columns)
-        {
-            Iterator<ColumnMap> it = columns.values().iterator();
-            int i = 0;
-            while (it.hasNext())
-            {
-                tableColumns[i++] = it.next();
-            }
-        }
+        ColumnMap[] tableColumns = columns.values()
+                .toArray(new ColumnMap[0]);
+
         return tableColumns;
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org
For additional commands, e-mail: torque-dev-h...@db.apache.org

Reply via email to