JDK-8172827 : Lock contention on java.security.Provider.getService
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Affected Version: 8u112
  • Priority: P3
  • Status: Resolved
  • Resolution: Not an Issue
  • Submitted: 2017-01-16
  • Updated: 2020-08-05
  • Resolved: 2017-03-13
Related Reports
Duplicate :  
Relates :  
Application with many threads each calling Provider.getService()
The application had multiple threads calling java.security.Provider.getService repeatedly. Unfortunately since this method is synchronized this caused a bottleneck. Generally speaking we end up calling Provider.getService() when attempting to find a crypto provider for a given operation (such as Cipher.getInstance()) In order to alleviate this problem applications should cache the result of the Cipher.getInstance() call per thread and reinitialise (Cipher.init(...)) the cached copy instead of calling Cipher.getInstance() again. This allows the application to avoid calling Provider.getService() repeatedly.