You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/04/12 11:48:24 UTC

[camel] branch camel-2.21.x updated: CAMEL-12435: camel-netty4 - Shared connection pool should re-create connection if its no longer valid

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

davsclaus pushed a commit to branch camel-2.21.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.21.x by this push:
     new 59248db  CAMEL-12435: camel-netty4 - Shared connection pool should re-create connection if its no longer valid
59248db is described below

commit 59248dbff9f4f334780c9bf3d2e8310fca2b3873
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Apr 12 13:46:15 2018 +0200

    CAMEL-12435: camel-netty4 - Shared connection pool should re-create connection if its no longer valid
---
 .../apache/camel/component/netty4/SharedSingletonObjectPool.java   | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
index 9121838..b7408bb 100644
--- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
+++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
@@ -38,6 +38,13 @@ public class SharedSingletonObjectPool<T> implements ObjectPool<T> {
 
     @Override
     public synchronized T borrowObject() throws Exception, NoSuchElementException, IllegalStateException {
+        if (t != null) {
+            // ensure the object is validate before we borrow it
+            if (!factory.validateObject(t)) {
+                invalidateObject(t);
+                t = null;
+            }
+        }
         if (t == null) {
             t = factory.makeObject();
         }

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.