[libpostgresql-jdbc-java] 01/08: Fix a minor concurrency issue during the setup for processing escape functions.

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:20:42 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to tag REL8_2_512
in repository libpostgresql-jdbc-java.

commit 5a0fe3b63984bd267c513677031986f23fc38816
Author: Kris Jurka <books at ejurka.com>
Date:   Tue Aug 10 18:18:53 2010 +0000

    Fix a minor concurrency issue during the setup for processing
    escape functions.
    
    Pierre Queinnec
---
 org/postgresql/jdbc2/EscapedFunctions.java | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/org/postgresql/jdbc2/EscapedFunctions.java b/org/postgresql/jdbc2/EscapedFunctions.java
index 4152e9f..8bdec9f 100644
--- a/org/postgresql/jdbc2/EscapedFunctions.java
+++ b/org/postgresql/jdbc2/EscapedFunctions.java
@@ -3,7 +3,7 @@
 * Copyright (c) 2004-2005, PostgreSQL Global Development Group
 *
 * IDENTIFICATION
-* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/EscapedFunctions.java,v 1.8.2.1 2008/02/19 06:12:41 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/EscapedFunctions.java,v 1.8.2.2 2008/11/16 12:14:27 jurka Exp $
 *
 *-------------------------------------------------------------------------
 */
@@ -117,23 +117,25 @@ public class EscapedFunctions {
     
     
     /** storage for functions implementations */
-    private static Map functionMap = null;
-    
+    private static Map functionMap = createFunctionMap();
+
+    private static Map createFunctionMap() {
+    	Method[] arrayMeths = EscapedFunctions.class.getDeclaredMethods();
+        Map functionMap = new HashMap(arrayMeths.length*2);
+        for (int i=0;i<arrayMeths.length;i++){
+            Method meth = arrayMeths[i];
+            if (meth.getName().startsWith("sql"))
+                functionMap.put(meth.getName().toLowerCase(Locale.US),meth);
+        }
+	return functionMap;
+    }
+
     /**
      * get Method object implementing the given function
      * @param functionName name of the searched function
      * @return a Method object or null if not found
      */
     public static Method getFunction(String functionName){
-        if (functionMap==null){
-            Method[] arrayMeths = EscapedFunctions.class.getDeclaredMethods();
-            functionMap = new HashMap(arrayMeths.length*2);
-            for (int i=0;i<arrayMeths.length;i++){
-                Method meth = arrayMeths[i];
-                if (meth.getName().startsWith("sql"))
-                    functionMap.put(meth.getName().toLowerCase(Locale.US),meth);
-            }
-        }
         return (Method) functionMap.get("sql"+functionName.toLowerCase(Locale.US));
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git



More information about the pkg-java-commits mailing list