Thanks for the detailed bug report and for the PR @thomasgl-orange!

Although I fully understand the memory leak, I'm a bit concerned about 
introducing a cross-context instance. If at some point the JDK bug gets fixed, 
users might expect all context-scoped resources to be released when the context 
is closed, and having a static reference by default there might not be expected.

Instead of preconfiguring a shared instance, what about modifying the 
[BouncyCastleCryptoModule](https://github.com/jclouds/jclouds/blob/master/drivers/bouncycastle/src/main/java/org/jclouds/encryption/bouncycastle/config/BouncyCastleCryptoModule.java)
 to provide an alternate constructor that gets a `BouncyCastleProvider`, and 
have that one (or a per-context default one, to keep the current behavior) 
injected? This way users could keep using the current behavior or instantiate 
the provider themselves (by passing a reference to a static instance). This is 
also the approach we already use in the 
[CredentialStoreModule](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/rest/config/CredentialStoreModule.java)
 for users that want credential persistence across contexts.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1156#issuecomment-344000530

Reply via email to