Skip to content

Commit a193442

Browse files
michael-simonsZhen Li
authored and
Zhen Li
committed
Use only BookmarksHolder contract instead of concrete NetworkSession.
1 parent bb1ad0f commit a193442

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,16 @@ private enum State
6767

6868
private final Connection connection;
6969
private final BoltProtocol protocol;
70-
private final NetworkSession session;
70+
private final BookmarksHolder bookmarksHolder;
7171
private final ResultCursorsHolder resultCursors;
7272

7373
private volatile State state = State.ACTIVE;
7474

75-
public ExplicitTransaction( Connection connection, NetworkSession session )
75+
public ExplicitTransaction( Connection connection, BookmarksHolder bookmarksHolder )
7676
{
7777
this.connection = connection;
7878
this.protocol = connection.protocol();
79-
this.session = session;
79+
this.bookmarksHolder = bookmarksHolder;
8080
this.resultCursors = new ResultCursorsHolder();
8181
}
8282

@@ -247,12 +247,7 @@ private CompletionStage<Void> doCommitAsync()
247247
return failedFuture( new ClientException( "Transaction can't be committed. " +
248248
"It has been rolled back either because of an error or explicit termination" ) );
249249
}
250-
return protocol.commitTransaction( connection )
251-
.thenApply( newBookmarks ->
252-
{
253-
session.setBookmarks( newBookmarks );
254-
return null;
255-
} );
250+
return protocol.commitTransaction( connection ).thenAccept( bookmarksHolder::setBookmarks );
256251
}
257252

258253
private CompletionStage<Void> doRollbackAsync()

0 commit comments

Comments
 (0)