Skip to content
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

Idle timer on each pooled connection to record the idle time elapsed #165

Merged
merged 1 commit into from Apr 10, 2017

Conversation

zhenlineo
Copy link
Contributor

By default the connection pool will not timeout any connection inside the pool. As long as the connection is still "open", then the connection is reused.
While a user could enable idle timeout on connections by setting ConnectionIdleTimeout to be a non-negative number.
Then when reusing connections from the pool, connections that have been idle for longer than the configured time will be closed directly.

Notes:

  • The timer is implemented using Stopwatch, the time elapsed is loosely precise.
  • The connection will not immediately be closed when idle timeout reached, instead it will be closed in the same thread that get it out of the pool.

…elapsed.

By default the connection pool will not timeout any connection inside the pool. As long as the connection is still "open", then the connection is reused.
While a user could enable idle timeout on connections by setting `ConnectionIdleTimeout` to be a non-negative number.
Then when reusing connections from the pool, connections that have been idle for longer than the configured time will be closed directly.

Notes:
* The timer is implemented using `Stopwatch`, the time elapsed is loosely precise.
* The connection will not immediately be closed when idle timeout reached, instead it will be closed in the same thread that get it out of the pool.
@zhenlineo
Copy link
Contributor Author

@cskardon I am trying to start solving #145 by making smaller changes. So this PR added a simple timer on each connection and let the pool close the connections that has been idle for too long in the caller thread.

It would be great if we do not need to introduce another thread to close connections.

@zhenlineo zhenlineo merged commit 3271217 into neo4j:1.2 Apr 10, 2017
@zhenlineo zhenlineo deleted the 1.2-idle-timer-on-conn branch April 10, 2017 14:45
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.

None yet

1 participant