0

Are javax.net.ssl.SSLContext and javax.net.ssl.SSLSocketFactory safe to store in a static field of the class that uses it? Can I use the one object for everything? I'm using it in a TAI in WebSphere Liberty Profile.

Westy
  • 707
  • 2
  • 10
  • 23
  • what purpose do you have for storing it in a static field? If it's the default context, could you just use `SSLContext.getDefault()` instead? – Andy Guibert Sep 22 '16 at 22:50
  • It isn't the default context, I've had to add a TrustManager and TrustStore. – Westy Sep 26 '16 at 13:17
  • Why not? If your entire application need to use the same `SSLContext` and want to use the same `SSLSocketFactory`, I see no harm there. But you have to be careful how you implement it – Imesha Sudasingha Dec 22 '16 at 04:58

0 Answers0