From 2a7bb9d7eda865dbf5fca3ca94a33c325e7ab6e5 Mon Sep 17 00:00:00 2001
From: Maxim Thomas <maxim.thomas@gmail.com>
Date: Wed, 09 Sep 2026 07:25:51 +0000
Subject: [PATCH] [#885] Give a connection of the JDBC pool a read bound of its own, and take it off for a statement that carries none (#934)
---
opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java
index 7e4241b..0272ec0 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/jdbc/TestCase.java
@@ -240,6 +240,33 @@
}
}
+ /**
+ * And the bound that replaces it reaches the socket of the driver: set with setNetworkTimeout
+ * once the login is through, it is read back off the connection the pool hands out (#885). The
+ * unit tests pin which value is set, on a mock that can only answer that it was asked; this is
+ * the driver of a real engine answering that it took it.
+ */
+ @Test(timeOut = 120000)
+ public void testTheStandingReadBoundReachesTheSocket() throws Exception {
+ final String url = createBackendCfg().getDBDirectory();
+ final int configured = CachedConnection.readTimeoutMillis;
+ CachedConnection.readTimeoutMillis = 5000;
+ try {
+ assertEquals(CachedConnection.standingReadBoundMillis(url), 5000,
+ "the url of this container carries a read bound of its own, so no bound of ours is set on it");
+ // a pooled connection would be handed back without being established again
+ CachedConnection.poolOf(url).drainIdle();
+ try (final Connection con = CachedConnection.getConnection(url)) {
+ assertEquals(con.getNetworkTimeout(), 5000,
+ "the read bound of this backend did not reach the socket of this driver");
+ }
+ } finally {
+ CachedConnection.readTimeoutMillis = configured;
+ // and nothing carrying the bound of this test goes back to the pool the suite goes on using
+ CachedConnection.poolOf(url).drainIdle();
+ }
+ }
+
private static ByteString key(int i) {
return ByteString.valueOfUtf8(String.format("key%02d", i));
}
--
Gitblit v1.10.0