JSSE: skip storeLock synchronization in printSessionStoreStatus() if debug not enabled, reduces thread contention

pull/274/head
Chris Conlon 2025-06-10 11:54:29 -06:00
parent 5be4a99e0d
commit 81bc1c0deb
2 changed files with 11 additions and 2 deletions

View File

@ -548,9 +548,13 @@ public class WolfSSLDebug {
}
/**
* Check if debug logging is enabled for the specified component
* Check if debug logging is enabled for the specified component.
*
* @param component the component to check (JNI or JSSE)
*
* @return true if debug logging is enabled for the component,
*/
private static boolean isDebugEnabled(Component component) {
public static boolean isDebugEnabled(Component component) {
if (component == Component.JSSE && DEBUG) {
return true;
}

View File

@ -534,6 +534,11 @@ public class WolfSSLAuthStore {
* prints out host:port of all sessions stored in the store.
* Called by getSession(). */
private void printSessionStoreStatus() {
if (!WolfSSLDebug.isDebugEnabled(WolfSSLDebug.Component.JSSE)) {
return;
}
synchronized (storeLock) {
Collection<WolfSSLImplementSSLSession> values =
store.values();