Skip to content

Commit 2d694ff

Browse files
committed
Move error handling logic to the connection layer
It was previously spread between `RoutingSession`, `RoutingTransaction` and `RoutingStatementResult` and they all did the same thing when connection errors happened. This commit introduces `RoutingPooledConnection` that handles errors for routing driver by removing entries from the routing table and purging connection pool for failed address.
1 parent acf28f0 commit 2d694ff

33 files changed

+1017
-1893
lines changed

driver/src/main/java/org/neo4j/driver/internal/ExplicitTransaction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import static org.neo4j.driver.v1.Values.ofValue;
4040
import static org.neo4j.driver.v1.Values.value;
4141

42-
class ExplicitTransaction implements Transaction
42+
public class ExplicitTransaction implements Transaction
4343
{
4444
private enum State
4545
{
@@ -71,7 +71,7 @@ private enum State
7171
private String bookmark = null;
7272
private State state = State.ACTIVE;
7373

74-
ExplicitTransaction( Connection conn, Runnable cleanup )
74+
public ExplicitTransaction( Connection conn, Runnable cleanup )
7575
{
7676
this( conn, cleanup, null );
7777
}

driver/src/main/java/org/neo4j/driver/internal/NetworkSession.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
public class NetworkSession implements Session
4343
{
44-
protected Connection connection;
44+
private final Connection connection;
4545
private final String sessionId;
4646
private final Logger logger;
4747

@@ -67,7 +67,7 @@ public void run()
6767
private ExplicitTransaction currentTransaction;
6868
private AtomicBoolean isOpen = new AtomicBoolean( true );
6969

70-
NetworkSession( Connection connection )
70+
public NetworkSession( Connection connection )
7171
{
7272
this.connection = connection;
7373

driver/src/main/java/org/neo4j/driver/internal/RoutingDriver.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ public RoutingDriver(
6363
protected Session newSessionWithMode( AccessMode mode )
6464
{
6565
Connection connection = acquireConnection( mode );
66-
Session networkSession = sessionFactory.newInstance( connection );
67-
return new RoutingNetworkSession( networkSession, mode, connection.boltServerAddress(), loadBalancer );
66+
return sessionFactory.newInstance( connection );
6867
}
6968

7069
private Connection acquireConnection( AccessMode role )

driver/src/main/java/org/neo4j/driver/internal/RoutingNetworkSession.java

Lines changed: 0 additions & 198 deletions
This file was deleted.

0 commit comments

Comments
 (0)