You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/02/13 13:30:50 UTC

[03/37] incubator-tinkerpop git commit: Keep the value of open counter in sync when connections fail.

Keep the value of open counter in sync when connections fail.

TINKERPOP-1127


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/f1800bd6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/f1800bd6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/f1800bd6

Branch: refs/heads/master
Commit: f1800bd65ea0393b59254a94aaed3fc22ac71f4f
Parents: c5b2421
Author: Kieran Sherlock <ki...@identitymind.com>
Authored: Fri Feb 5 09:54:57 2016 -0800
Committer: Kieran Sherlock <ki...@identitymind.com>
Committed: Fri Feb 5 09:54:57 2016 -0800

----------------------------------------------------------------------
 .../java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java  | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f1800bd6/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java
index 96c151c..19a29e4 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java
@@ -301,6 +301,7 @@ final class ConnectionPool {
             connections.add(new Connection(host.getHostUri(), this, settings().maxInProcessPerConnection));
         } catch (ConnectionException ce) {
             logger.debug("Connections were under max, but there was an error creating the connection.", ce);
+            open.decrementAndGet();
             considerUnavailable();
             return false;
         }
@@ -326,6 +327,7 @@ final class ConnectionPool {
     private void definitelyDestroyConnection(final Connection connection) {
         bin.add(connection);
         connections.remove(connection);
+        open.decrementAndGet();
 
         if (connection.borrowed.get() == 0 && bin.remove(connection))
             connection.closeAsync();
@@ -413,6 +415,7 @@ final class ConnectionPool {
             this.cluster.loadBalancingStrategy().onAvailable(host);
             return true;
         } catch (Exception ex) {
+            logger.debug("Failed reconnect attempt on {}", host);
             if (connection != null) definitelyDestroyConnection(connection);
             return false;
         }