[java-shib-shared] branch main updated: JSSH-71 Remove the impact of the DestructableComponent Interface
Codeberg
noreply at shibboleth.net
Wed Jul 15 10:07:27 UTC 2026
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch main
in repository java-shib-shared.
View the commit online:
https://codeberg.org/Shibboleth/java-shib-shared/commit/35f1e45ddb162028a93babfe512be0e4b4696ae4
The following commit(s) were added to refs/heads/main by this push:
new 35f1e45d JSSH-71 Remove the impact of the DestructableComponent Interface
35f1e45d is described below
commit 35f1e45ddb162028a93babfe512be0e4b4696ae4
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Jul 15 11:07:07 2026 +0100
JSSH-71 Remove the impact of the DestructableComponent Interface
https://shibboleth.atlassian.net/browse/JSSH-71
FileCachingHttpClientBuilder
Exbedded teardown function from destroy and made it thread safe.
---
.../httpclient/FileCachingHttpClientBuilder.java | 44 ++++++++++++++++------
1 file changed, 33 insertions(+), 11 deletions(-)
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/httpclient/FileCachingHttpClientBuilder.java b/shib-networking/src/main/java/net/shibboleth/shared/httpclient/FileCachingHttpClientBuilder.java
index db3c9485..83715fc5 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/httpclient/FileCachingHttpClientBuilder.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/httpclient/FileCachingHttpClientBuilder.java
@@ -37,6 +37,7 @@ import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.io.ModalCloseable;
import org.slf4j.Logger;
+import net.shibboleth.shared.annotation.OnTeardown;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.component.AbstractInitializableComponent;
@@ -366,20 +367,41 @@ public class FileCachingHttpClientBuilder extends HttpClientBuilder {
/** {@inheritDoc} */
public void destroy() {
- maintenanceTask.cancel();
- timer.cancel();
+ teardownStorageManagingHttpClient();
+ }
+
+ /**
+ * Method to tear down the object.
+ */
+ @OnTeardown
+ public final void teardownStorageManagingHttpClient() {
+
+ if (isDestroyed()) {
+ return;
+ }
+ final TimerTask localMaintenanceTask = maintenanceTask;
maintenanceTask = null;
+ if (localMaintenanceTask != null) {
+ localMaintenanceTask.cancel();
+ }
+
+ final Timer localTimer = timer;
timer = null;
-
- try {
- log.debug("Executing ManagedHttpCacheStorage shutdown()");
- storage.shutdown();
- } catch (final Throwable t) {
- log.warn("Error invoking ManagedHttpCacheStorage shutdown()", t);
+ if (localTimer != null) {
+ localTimer.cancel();
}
- storage = null;
- httpClient = null;
+ final ManagedHttpCacheStorage localStorage = storage;
+ storage = null;
+
+ if (localStorage != null) {
+ try {
+ log.debug("Executing ManagedHttpCacheStorage shutdown()");
+ localStorage.shutdown();
+ } catch (final Throwable t) {
+ log.warn("Error invoking ManagedHttpCacheStorage shutdown()", t);
+ }
+ }
destroyed = true;
}
@@ -417,4 +439,4 @@ public class FileCachingHttpClientBuilder extends HttpClientBuilder {
}
-}
\ No newline at end of file
+}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list