mirror of
https://github.com/apache/lucene.git
synced 2025-02-15 14:35:50 +00:00
SOLR-14205 Do not fail when given timeout to connectionImpl.isValid() = 0
Closes #1204 Signed-off-by: Kevin Risden <krisden@apache.org>
This commit is contained in:
parent
4dc793e648
commit
f34e1de7d8
@ -158,6 +158,8 @@ Bug Fixes
|
|||||||
|
|
||||||
* SOLR-14196: AdminUI login not working for JWTAuth when blockUnknown=false (janhoy)
|
* SOLR-14196: AdminUI login not working for JWTAuth when blockUnknown=false (janhoy)
|
||||||
|
|
||||||
|
* SOLR-14205: Do not fail when given timeout to connectionImpl.isValid() = 0 (Nick Vercammen via Kevin Risden)
|
||||||
|
|
||||||
Other Changes
|
Other Changes
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
@ -335,7 +335,11 @@ class ConnectionImpl implements Connection {
|
|||||||
// check that the connection isn't closed and able to connect within the timeout
|
// check that the connection isn't closed and able to connect within the timeout
|
||||||
try {
|
try {
|
||||||
if(!isClosed()) {
|
if(!isClosed()) {
|
||||||
this.client.connect(timeout, TimeUnit.SECONDS);
|
if (timeout == 0) {
|
||||||
|
this.client.connect();
|
||||||
|
} else {
|
||||||
|
this.client.connect(timeout, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (InterruptedException|TimeoutException ignore) {
|
} catch (InterruptedException|TimeoutException ignore) {
|
||||||
|
@ -496,6 +496,8 @@ public class JdbcTest extends SolrCloudTestCase {
|
|||||||
private void testJDBCMethods(String collection, String connectionString, Properties properties, String sql) throws Exception {
|
private void testJDBCMethods(String collection, String connectionString, Properties properties, String sql) throws Exception {
|
||||||
try (Connection con = DriverManager.getConnection(connectionString, properties)) {
|
try (Connection con = DriverManager.getConnection(connectionString, properties)) {
|
||||||
assertTrue(con.isValid(DEFAULT_CONNECTION_TIMEOUT));
|
assertTrue(con.isValid(DEFAULT_CONNECTION_TIMEOUT));
|
||||||
|
assertTrue("connection should be valid when checked with timeout = 0 -> con.isValid(0)", con.isValid(0));
|
||||||
|
|
||||||
|
|
||||||
assertEquals(zkHost, con.getCatalog());
|
assertEquals(zkHost, con.getCatalog());
|
||||||
con.setCatalog(zkHost);
|
con.setCatalog(zkHost);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user