Skip to content

Allow initial bookmark in session #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 13, 2017

Conversation

lutovich
Copy link
Contributor

Based on #215. Only last commit is new.

Commit adds second parameter bookmark to the existing Driver#session(accessMode) API function to allow creation of a session with the specified initial bookmark. This means that first transaction in the created session will ensure that the server, it is connected to, is at least up to the database version denoted by the bookmark.

Bookmark is a session related concept and this commit adds symmetry with regards to Session#lastBookmark() method.

So it could later use it to obtain connections on demand rather than
hold a single connection permanently.
This commit effectively decouples session from connection. Session now
holds two `ConnectionHolder`s that lazily pick connection from the pool
when it is needed and try to release connection back to the pool when it
does not have any users. Session keeps one connection holder for read
connection and one for write connection.

Connection is acquired for `Session#run()` and released when the
returned result is either fully consumed or error happens. Also
connection is acquired for `Session#beginTransaction()` and released
when transaction commits or rolls back.
This commit adds second parameter `bookmark` to the existing
`Driver#session(accessMode)` API function to allow creation of a session
with the specified initial bookmark. This means that first transaction in the
created session will ensure that the server, it is connected to, is at
least up to the database version denoted by the bookmark.

Bookmark is a session related concept and this commit adds symmetry with
regards to `Session#lastBookmark()` method.
@zhenlineo zhenlineo merged commit f222d80 into neo4j:1.2 Mar 13, 2017
@lutovich lutovich deleted the 1.2-initial-bookmark-in-session branch March 13, 2017 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants