You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by fl...@apache.org on 2018/06/27 17:27:06 UTC
[1/9] tinkerpop git commit: Add check for connection state before
returning it TINKERPOP-1978
Repository: tinkerpop
Updated Branches:
refs/heads/master cff4c1616 -> 935ef5c9d
refs/heads/tp32 160c1def3 -> c02b9934c
refs/heads/tp33 84c3ff40e -> 4f462c532
Add check for connection state before returning it TINKERPOP-1978
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c4a25472
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c4a25472
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c4a25472
Branch: refs/heads/master
Commit: c4a254726167d798617331ff3dd00ece97377b2d
Parents: 32aebb8
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Sat Jun 23 12:24:15 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Sat Jun 23 12:24:15 2018 +0200
----------------------------------------------------------------------
.../src/Gremlin.Net/Driver/ConnectionPool.cs | 26 +++++++++++++-------
1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c4a25472/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs
index 9501686..d9e53f4 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs
@@ -23,7 +23,6 @@
using System;
using System.Collections.Concurrent;
-using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Gremlin.Net.Process;
@@ -45,19 +44,28 @@ namespace Gremlin.Net.Driver
public async Task<IConnection> GetAvailableConnectionAsync()
{
- Connection connection = null;
- lock (_connectionsLock)
- {
- if (!_connections.IsEmpty)
- _connections.TryTake(out connection);
- }
-
- if (connection == null)
+ if (!TryGetConnectionFromPool(out var connection))
connection = await CreateNewConnectionAsync().ConfigureAwait(false);
return new ProxyConnection(connection, AddConnectionIfOpen);
}
+ private bool TryGetConnectionFromPool(out Connection connection)
+ {
+ while (true)
+ {
+ connection = null;
+ lock (_connectionsLock)
+ {
+ if (_connections.IsEmpty) return false;
+ _connections.TryTake(out connection);
+ }
+
+ if (connection.IsOpen) return true;
+ connection.Dispose();
+ }
+ }
+
private async Task<Connection> CreateNewConnectionAsync()
{
NrConnections++;
[3/9] tinkerpop git commit: Add check for connection state before
returning it TINKERPOP-1978
Posted by fl...@apache.org.
Add check for connection state before returning it TINKERPOP-1978
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c4a25472
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c4a25472
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c4a25472
Branch: refs/heads/tp33
Commit: c4a254726167d798617331ff3dd00ece97377b2d
Parents: 32aebb8
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Sat Jun 23 12:24:15 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Sat Jun 23 12:24:15 2018 +0200
----------------------------------------------------------------------
.../src/Gremlin.Net/Driver/ConnectionPool.cs | 26 +++++++++++++-------
1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c4a25472/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs
index 9501686..d9e53f4 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs
@@ -23,7 +23,6 @@
using System;
using System.Collections.Concurrent;
-using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Gremlin.Net.Process;
@@ -45,19 +44,28 @@ namespace Gremlin.Net.Driver
public async Task<IConnection> GetAvailableConnectionAsync()
{
- Connection connection = null;
- lock (_connectionsLock)
- {
- if (!_connections.IsEmpty)
- _connections.TryTake(out connection);
- }
-
- if (connection == null)
+ if (!TryGetConnectionFromPool(out var connection))
connection = await CreateNewConnectionAsync().ConfigureAwait(false);
return new ProxyConnection(connection, AddConnectionIfOpen);
}
+ private bool TryGetConnectionFromPool(out Connection connection)
+ {
+ while (true)
+ {
+ connection = null;
+ lock (_connectionsLock)
+ {
+ if (_connections.IsEmpty) return false;
+ _connections.TryTake(out connection);
+ }
+
+ if (connection.IsOpen) return true;
+ connection.Dispose();
+ }
+ }
+
private async Task<Connection> CreateNewConnectionAsync()
{
NrConnections++;
[8/9] tinkerpop git commit: Merge branch 'tp32' into tp33
Posted by fl...@apache.org.
Merge branch 'tp32' into tp33
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/4f462c53
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/4f462c53
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/4f462c53
Branch: refs/heads/tp33
Commit: 4f462c5327e04c475db6c9b6af38e36587610480
Parents: 84c3ff4 c02b993
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Wed Jun 27 19:20:37 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Wed Jun 27 19:20:37 2018 +0200
----------------------------------------------------------------------
.../src/Gremlin.Net/Driver/ConnectionPool.cs | 26 +++++++++++++-------
1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
[2/9] tinkerpop git commit: Add check for connection state before
returning it TINKERPOP-1978
Posted by fl...@apache.org.
Add check for connection state before returning it TINKERPOP-1978
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c4a25472
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c4a25472
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c4a25472
Branch: refs/heads/tp32
Commit: c4a254726167d798617331ff3dd00ece97377b2d
Parents: 32aebb8
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Sat Jun 23 12:24:15 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Sat Jun 23 12:24:15 2018 +0200
----------------------------------------------------------------------
.../src/Gremlin.Net/Driver/ConnectionPool.cs | 26 +++++++++++++-------
1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c4a25472/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs
index 9501686..d9e53f4 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionPool.cs
@@ -23,7 +23,6 @@
using System;
using System.Collections.Concurrent;
-using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Gremlin.Net.Process;
@@ -45,19 +44,28 @@ namespace Gremlin.Net.Driver
public async Task<IConnection> GetAvailableConnectionAsync()
{
- Connection connection = null;
- lock (_connectionsLock)
- {
- if (!_connections.IsEmpty)
- _connections.TryTake(out connection);
- }
-
- if (connection == null)
+ if (!TryGetConnectionFromPool(out var connection))
connection = await CreateNewConnectionAsync().ConfigureAwait(false);
return new ProxyConnection(connection, AddConnectionIfOpen);
}
+ private bool TryGetConnectionFromPool(out Connection connection)
+ {
+ while (true)
+ {
+ connection = null;
+ lock (_connectionsLock)
+ {
+ if (_connections.IsEmpty) return false;
+ _connections.TryTake(out connection);
+ }
+
+ if (connection.IsOpen) return true;
+ connection.Dispose();
+ }
+ }
+
private async Task<Connection> CreateNewConnectionAsync()
{
NrConnections++;
[6/9] tinkerpop git commit: Merge branch 'TINKERPOP-1978' into tp32
Posted by fl...@apache.org.
Merge branch 'TINKERPOP-1978' into tp32
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c02b9934
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c02b9934
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c02b9934
Branch: refs/heads/master
Commit: c02b9934c73d7b915333cb873e97de7789f35a80
Parents: 160c1de c4a2547
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Wed Jun 27 19:19:12 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Wed Jun 27 19:19:12 2018 +0200
----------------------------------------------------------------------
.../src/Gremlin.Net/Driver/ConnectionPool.cs | 26 +++++++++++++-------
1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
[4/9] tinkerpop git commit: Merge branch 'TINKERPOP-1978' into tp32
Posted by fl...@apache.org.
Merge branch 'TINKERPOP-1978' into tp32
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c02b9934
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c02b9934
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c02b9934
Branch: refs/heads/tp33
Commit: c02b9934c73d7b915333cb873e97de7789f35a80
Parents: 160c1de c4a2547
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Wed Jun 27 19:19:12 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Wed Jun 27 19:19:12 2018 +0200
----------------------------------------------------------------------
.../src/Gremlin.Net/Driver/ConnectionPool.cs | 26 +++++++++++++-------
1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
[9/9] tinkerpop git commit: Merge branch 'tp33'
Posted by fl...@apache.org.
Merge branch 'tp33'
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/935ef5c9
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/935ef5c9
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/935ef5c9
Branch: refs/heads/master
Commit: 935ef5c9db8209db30986b8de57d012cdf656e9e
Parents: cff4c16 4f462c5
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Wed Jun 27 19:21:19 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Wed Jun 27 19:21:19 2018 +0200
----------------------------------------------------------------------
.../src/Gremlin.Net/Driver/ConnectionPool.cs | 26 +++++++++++++-------
1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
[5/9] tinkerpop git commit: Merge branch 'TINKERPOP-1978' into tp32
Posted by fl...@apache.org.
Merge branch 'TINKERPOP-1978' into tp32
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c02b9934
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c02b9934
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c02b9934
Branch: refs/heads/tp32
Commit: c02b9934c73d7b915333cb873e97de7789f35a80
Parents: 160c1de c4a2547
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Wed Jun 27 19:19:12 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Wed Jun 27 19:19:12 2018 +0200
----------------------------------------------------------------------
.../src/Gremlin.Net/Driver/ConnectionPool.cs | 26 +++++++++++++-------
1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
[7/9] tinkerpop git commit: Merge branch 'tp32' into tp33
Posted by fl...@apache.org.
Merge branch 'tp32' into tp33
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/4f462c53
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/4f462c53
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/4f462c53
Branch: refs/heads/master
Commit: 4f462c5327e04c475db6c9b6af38e36587610480
Parents: 84c3ff4 c02b993
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Wed Jun 27 19:20:37 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Wed Jun 27 19:20:37 2018 +0200
----------------------------------------------------------------------
.../src/Gremlin.Net/Driver/ConnectionPool.cs | 26 +++++++++++++-------
1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------