From a4ae8a61e123cb4a866f865d59b7903664d80c93 Mon Sep 17 00:00:00 2001 From: Jody Grassel Date: Thu, 9 Apr 2015 20:53:51 +0000 Subject: [PATCH] OPENJPA-2570: Allow an informix user the option to disable the RETAINUPDATELOCKS sql git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1672487 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/jdbc/sql/InformixDictionary.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java index 974bea1b7..a37560725 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java @@ -324,19 +324,21 @@ public class InformixDictionary // if we haven't already done so, initialize the lock mode of the // connection - if (_seenConnections.add(conn)) { - if (lockModeEnabled) { - String sql = "SET LOCK MODE TO WAIT"; - if (lockWaitSeconds > 0) - sql = sql + " " + lockWaitSeconds; - execute(sql, conn, true); + synchronized(_seenConnections) { + if (_seenConnections.add(conn)) { + if (lockModeEnabled) { + String sql = "SET LOCK MODE TO WAIT"; + if (lockWaitSeconds > 0) + sql = sql + " " + lockWaitSeconds; + execute(sql, conn, true); + } + + if (!disableRetainUpdateLocksSQL){ + String sql = "SET ENVIRONMENT RETAINUPDATELOCKS 'ALL'"; + execute(sql, conn, false); + } } - - if (!disableRetainUpdateLocksSQL){ - String sql = "SET ENVIRONMENT RETAINUPDATELOCKS 'ALL'"; - execute(sql, conn, false); - } - } + } // the datadirect driver requires that we issue a rollback before using // each connection