airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [5/5] airavata git commit: AIRAVATA-2408 Adding simple validation query for profile service
Date Sun, 11 Jun 2017 20:11:15 GMT
AIRAVATA-2408 Adding simple validation query for profile service

This is to prevent getting this error message for stale connections
that have been disconnected on the server:

> The last packet successfully received from the server was 168,524,628
> milliseconds ago.  The last packet sent successfully to the server was
> 168,524,629 milliseconds ago. is longer than the server configured value
> of 'wait_timeout'. You should consider either expiring and/or testing
> connection validity before use in your application, increasing the
> server configured values for client timeouts, or using the Connector/J
> connection property 'autoReconnect=true' to avoid this problem.


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/3eb804ba
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/3eb804ba
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/3eb804ba

Branch: refs/heads/develop
Commit: 3eb804ba597888f4fc7edd94da6a2d1603d1b0ad
Parents: c0c585f
Author: Marcus Christie <machristie@apache.org>
Authored: Sun Jun 11 16:08:46 2017 -0400
Committer: Marcus Christie <machristie@apache.org>
Committed: Sun Jun 11 16:08:46 2017 -0400

----------------------------------------------------------------------
 .../apache/airavata/service/profile/commons/utils/JPAUtils.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/3eb804ba/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAUtils.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAUtils.java
b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAUtils.java
index e3a963d..3540d4f 100644
--- a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAUtils.java
+++ b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAUtils.java
@@ -38,10 +38,10 @@ public class JPAUtils {
         EntityManager entityManager;
 
         if (factory == null) {
-            //FIXME: add validation query in connectionProperties after db is initialized
during server startup
             String connectionProperties = "DriverClassName=" + Utils.getJDBCDriver() + ","
+ "Url=" +
                     Utils.getJDBCURL() + "?autoReconnect=true," +
-                    "Username=" + Utils.getJDBCUser() + "," + "Password=" + Utils.getJDBCPassword();
+                    "Username=" + Utils.getJDBCUser() + "," + "Password=" + Utils.getJDBCPassword()
+ "," +
+                    "validationQuery=select 1";
             logger.info(connectionProperties);
             Map<String, String> properties = new HashMap<String, String>();
             properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");


Mime
View raw message