diff options
author | Valerij Fredriksen <valerijf@oath.com> | 2018-01-10 12:55:25 +0100 |
---|---|---|
committer | Valerij Fredriksen <valerijf@oath.com> | 2018-01-10 13:51:32 +0100 |
commit | 5d570854ef77d6b474fc0ebf50cd002415c170e1 (patch) | |
tree | 65e2f0cbfb4735b77ccf4c2f4023bfc66556db1b /node-admin | |
parent | d9518a87387b6b29db4c1e590f8e65421161fef0 (diff) |
Set volatile, add comment
Diffstat (limited to 'node-admin')
-rw-r--r-- | node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutor.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutor.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutor.java index 64de416e3dc..7b7de0e7417 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutor.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutor.java @@ -50,7 +50,15 @@ public class ConfigServerHttpRequestExecutor implements AutoCloseable { Executors.newScheduledThreadPool(1, ThreadFactoryFactory.getDaemonThreadFactory("http-client-refresher")); private final List<URI> configServerHosts; - private SelfCloseableHttpClient client; + /** + * The 'client' will be periodically re-created by clientRefresherScheduler if we provide keyStoreOptions + * or trustStoreOptions. This is needed because the key/trust stores are updated outside of node-admin, + * but we want to use the most recent store. + * + * The 'client' reference must be volatile because it is set and read in different threads, and visibility + * of changes is only guaranteed for volatile variables. + */ + private volatile SelfCloseableHttpClient client; public static ConfigServerHttpRequestExecutor create( Collection<URI> configServerUris, Optional<KeyStoreOptions> keyStoreOptions, Optional<KeyStoreOptions> trustStoreOptions) { |