You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2020/01/08 21:37:57 UTC

[airavata] branch develop updated (ccc0648 -> 66daa39)

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git.


    from ccc0648  Merge branch 'airavata-3276' into develop
     add 566166d  Ansible: for dreg, sets max upload size to 1GB
     add 57262f7  updating the Django futurewater with the main gateway domain
     add f2a5f31  updating the Django futurewater with the main gateway domain
     add 38f0644  Ansible: fix sudo yum install of django prereqs
     new 98efce7  AIRAVATA-3186 Log abandoned thrift clients to slf4j logger
     new 66daa39  Merge branch 'AIRAVATA-3186-slf4j-log-abandoned' into develop

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../scigap/production/host_vars/dreg/vars.yml           |  2 ++
 .../scigap/production/host_vars/futurewater/vars.yml    |  8 ++++----
 dev-tools/ansible/roles/django_setup/tasks/main.yml     |  2 +-
 .../apache/airavata/common/utils/ThriftClientPool.java  | 17 +++++++++++++++++
 .../airavata/common/utils/ThriftClientPoolTest.java     | 11 +++++++++++
 5 files changed, 35 insertions(+), 5 deletions(-)


[airavata] 01/02: AIRAVATA-3186 Log abandoned thrift clients to slf4j logger

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 98efce7587cbc5680175e5697c7d359cb2c09771
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed Jan 8 16:33:09 2020 -0500

    AIRAVATA-3186 Log abandoned thrift clients to slf4j logger
---
 .../apache/airavata/common/utils/ThriftClientPool.java  | 17 +++++++++++++++++
 .../airavata/common/utils/ThriftClientPoolTest.java     | 11 +++++++++++
 2 files changed, 28 insertions(+)

diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/ThriftClientPool.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/ThriftClientPool.java
index 6a0bc2a..f4980a3 100644
--- a/modules/commons/src/main/java/org/apache/airavata/common/utils/ThriftClientPool.java
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/ThriftClientPool.java
@@ -19,6 +19,9 @@
  */
 package org.apache.airavata.common.utils;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
 import org.apache.airavata.base.api.BaseAPI;
 import org.apache.commons.pool2.BasePooledObjectFactory;
 import org.apache.commons.pool2.PooledObject;
@@ -40,6 +43,19 @@ public class ThriftClientPool<T extends BaseAPI.Client> implements AutoCloseable
 
     private final GenericObjectPool<T> internalPool;
 
+    /**
+     * StringWriter that flushes to SLF4J logger.
+     */
+    private static class ErrorLoggingStringWriter extends StringWriter {
+
+        @Override
+        public void flush() {
+            logger.error(this.toString());
+            // Reset buffer
+            this.getBuffer().setLength(0);
+        }
+    }
+
     public ThriftClientPool(ClientFactory<T> clientFactory, GenericObjectPoolConfig<T> poolConfig, String host,
             int port) {
         this(clientFactory, new BinaryOverSocketProtocolFactory(host, port), poolConfig);
@@ -54,6 +70,7 @@ public class ThriftClientPool<T extends BaseAPI.Client> implements AutoCloseable
             abandonedConfig.setLogAbandoned(true);
             abandonedConfig.setRemoveAbandonedOnBorrow(true);
             abandonedConfig.setRemoveAbandonedOnMaintenance(true);
+            abandonedConfig.setLogWriter(new PrintWriter(new ErrorLoggingStringWriter()));
         }
         this.internalPool = new GenericObjectPool<T>(new ThriftClientFactory(clientFactory, protocolFactory),
                 poolConfig, abandonedConfig);
diff --git a/modules/commons/src/test/java/org/apache/airavata/common/utils/ThriftClientPoolTest.java b/modules/commons/src/test/java/org/apache/airavata/common/utils/ThriftClientPoolTest.java
index 8bdefe9..5943fdf 100644
--- a/modules/commons/src/test/java/org/apache/airavata/common/utils/ThriftClientPoolTest.java
+++ b/modules/commons/src/test/java/org/apache/airavata/common/utils/ThriftClientPoolTest.java
@@ -1,5 +1,8 @@
 package org.apache.airavata.common.utils;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
 import org.apache.airavata.base.api.BaseAPI;
 import org.apache.airavata.common.exception.ApplicationSettingsException;
 import org.apache.commons.pool2.impl.AbandonedConfig;
@@ -71,6 +74,10 @@ public class ThriftClientPoolTest {
         abandonedConfig.setRemoveAbandonedTimeout(1);
         abandonedConfig.setRemoveAbandonedOnMaintenance(true);
         abandonedConfig.setLogAbandoned(true);
+        StringWriter log = new StringWriter();
+        Assert.assertEquals("Initial length of log is 0", 0, log.toString().length());
+        PrintWriter logWriter = new PrintWriter(log);
+        abandonedConfig.setLogWriter(logWriter);
         ThriftClientPool<BaseAPI.Client> thriftClientPool = new ThriftClientPool<>((protocol) -> mockClient, () -> null,
                 poolConfig, abandonedConfig);
         thriftClientPool.getResource();
@@ -82,6 +89,10 @@ public class ThriftClientPoolTest {
             Assert.fail("sleep interrupted");
         }
 
+        Assert.assertTrue(log.toString().length() > 0);
+        // The stack trace should contain this method's name
+        Assert.assertTrue(log.toString().contains("testWithAbandonConfigAndAbandoned"));
+
         new Verifications() {
             {
                 // Verify client is destroyed when abandoned


[airavata] 02/02: Merge branch 'AIRAVATA-3186-slf4j-log-abandoned' into develop

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 66daa39aa837e8a782385b186404949b66eda9cd
Merge: ccc0648 98efce7
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed Jan 8 16:37:06 2020 -0500

    Merge branch 'AIRAVATA-3186-slf4j-log-abandoned' into develop

 .../scigap/production/host_vars/dreg/vars.yml           |  2 ++
 .../scigap/production/host_vars/futurewater/vars.yml    |  8 ++++----
 dev-tools/ansible/roles/django_setup/tasks/main.yml     |  2 +-
 .../apache/airavata/common/utils/ThriftClientPool.java  | 17 +++++++++++++++++
 .../airavata/common/utils/ThriftClientPoolTest.java     | 11 +++++++++++
 5 files changed, 35 insertions(+), 5 deletions(-)