Skip to content

Conversation

garyrussell
Copy link
Contributor

Resolves: #3199

Previously, the FCCF did not cache a shared connection; if server 1 is down
and server 2 is up, this caused an attempt to connect to server 1 every time
we got the connection.

Add 2 options: refreshSharedInterval and closeOnRefresh, defaulting to
0 and false respectively, to maintain the same behavior as before the options
existed.

Disallow caching of the single shared connection if the delegate factories are
CachingClientConnectionFactory instances.

cherry-pick to 5.2.x

I will backport to 5.1.x, 4.3.x after review/merge.

Resolves: spring-projects#3199

Previously, the FCCF did not cache a shared connection; if server 1 is down
and server 2 is up, this caused an attempt to connect to server 1 every time
we got the connection.

Add 2 options: `refreshSharedInterval` and `closeOnRefresh`, defaulting to
0 and false respectively, to maintain the same behavior as before the options
existed.

Disallow caching of the single shared connection if the delegate factories are
`CachingClientConnectionFactory` instances.

**cherry-pick to 5.2.x**

I will backport to 5.1.x, 4.3.x after review/merge.
Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found only a typo in a doc


Set `refreshSharedInterval` to only attempt to reconnect with the first factory after that time has expired; set it to `Long.MAX_VALUE` if you only want to fail back to the first factory when the current connection fails.

Set `closeOnRefresh` to close thee "old" connection after a refresh actually creates a new connection.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Set `closeOnRefresh` to close thee "old" connection after a refresh actually creates a new connection.
Set `closeOnRefresh` to close the "old" connection after a refresh actually creates a new connection.

@artembilan artembilan merged commit 4180e01 into spring-projects:master Feb 28, 2020
@garyrussell garyrussell deleted the GH-3199 branch February 28, 2020 20:55
@garyrussell
Copy link
Contributor Author

Backports:

5.2.x ac7441a
5.1.x dc266fa
4.3.x fa0caeb

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.

FailoverClientConnectionFactory does not cache shared connection

2 participants