Skip to content

Commit 827c228

Browse files
committed
Removed unnecessary method in NetworkSession
`CompletionStage` that holds current connection can't be failed because all exceptions are handled when writing to the field. This commit removes unneeded method that tried to handle all exceptions.
1 parent 975526f commit 827c228

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ private CompletionStage<Void> rollbackTransaction()
520520

521521
private CompletionStage<Void> releaseConnection()
522522
{
523-
return existingConnectionOrNull().thenCompose( connection ->
523+
return connectionStage.thenCompose( connection ->
524524
{
525525
if ( connection != null )
526526
{
@@ -575,15 +575,10 @@ private CompletionStage<Void> ensureNoOpenTx( String errorMessage )
575575
private CompletionStage<ExplicitTransaction> existingTransactionOrNull()
576576
{
577577
return transactionStage
578-
.exceptionally( error -> null ) // handle previous acquisition failures
578+
.exceptionally( error -> null ) // handle previous connection acquisition and tx begin failures
579579
.thenApply( tx -> tx != null && tx.isOpen() ? tx : null );
580580
}
581581

582-
private CompletionStage<Connection> existingConnectionOrNull()
583-
{
584-
return connectionStage.exceptionally( error -> null ); // handle previous acquisition failures
585-
}
586-
587582
private void ensureSessionIsOpen()
588583
{
589584
if ( !open.get() )

0 commit comments

Comments
 (0)