Skip to content

Commit fd05f88

Browse files
author
Zhen
committed
Fix a path where we forget to close the connection when exceptions thrown in sync
1 parent 4314207 commit fd05f88

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,14 @@ public void close()
125125
// Best-effort
126126
}
127127
}
128-
connection.sync();
129-
connection.close();
128+
try
129+
{
130+
connection.sync();
131+
}
132+
finally
133+
{
134+
connection.close();
135+
}
130136
}
131137
}
132138

driver/src/main/java/org/neo4j/driver/internal/pool/InternalConnectionPool.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
* is full or the pool is being cleaned on driver.close, then we directly close the connection attached with the
4848
* session.
4949
*
50-
* The session is NOT meat to be thread safe, each thread should have an independent session and close it (return to
50+
* The session is NOT meant to be thread safe, each thread should have an independent session and close it (return to
5151
* pool) when the work with the session has been done.
5252
*
5353
* The driver is thread safe. Each thread could try to get a session from the pool and then return it to the pool

0 commit comments

Comments
 (0)