This is an automated email from the ASF dual-hosted git repository.
tabish pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new 7882c92e5d ARTEMIS-5049 add detailed logging for auth caches
7882c92e5d is described below
commit 7882c92e5dd1902ecb8c8fa8efaad041bfcbafac
Author: Justin Bertram <[email protected]>
AuthorDate: Wed Sep 18 15:04:06 2024 -0500
ARTEMIS-5049 add detailed logging for auth caches
---
.../core/security/impl/SecurityStoreImpl.java | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
index ed51e17640..ec7b50ca8a 100644
---
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
+++
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java
@@ -120,6 +120,7 @@ public class SecurityStoreImpl implements SecurityStore,
HierarchicalRepositoryC
.expireAfterWrite(invalidationInterval, TimeUnit.MILLISECONDS)
.recordStats()
.build();
+ logger.trace("Created authn cache: {}; maxSize: {};
invalidationInterval: {}", authenticationCache, authenticationCacheSize,
invalidationInterval);
}
if (authorizationCacheSize == 0) {
authorizationCache = null;
@@ -129,6 +130,7 @@ public class SecurityStoreImpl implements SecurityStore,
HierarchicalRepositoryC
.expireAfterWrite(invalidationInterval, TimeUnit.MILLISECONDS)
.recordStats()
.build();
+ logger.trace("Created authz cache: {}; maxSize: {};
invalidationInterval: {}", authorizationCache, authorizationCacheSize,
invalidationInterval);
}
this.securityRepository.registerListener(this);
} else {
@@ -473,7 +475,9 @@ public class SecurityStoreImpl implements SecurityStore,
HierarchicalRepositoryC
private void putAuthenticationCacheEntry(String key, Subject subject) {
if (authenticationCache != null) {
- authenticationCache.put(key, new Pair<>(subject != null, subject));
+ Pair<Boolean, Subject> value = new Pair<>(subject != null, subject);
+ authenticationCache.put(key, value);
+ logger.trace("Put into authn cache; key: {}; value: {}", key, value);
}
}
@@ -481,13 +485,16 @@ public class SecurityStoreImpl implements SecurityStore,
HierarchicalRepositoryC
if (authenticationCache == null) {
return null;
} else {
- return authenticationCache.getIfPresent(key);
+ Pair<Boolean, Subject> value = authenticationCache.getIfPresent(key);
+ logger.trace("Get from authn cache; key: {}; value: {}", key, value);
+ return value;
}
}
- private void putAuthorizationCacheEntry(ConcurrentHashSet<SimpleString>
set, String key) {
+ private void putAuthorizationCacheEntry(ConcurrentHashSet<SimpleString>
value, String key) {
if (authorizationCache != null) {
- authorizationCache.put(key, set);
+ authorizationCache.put(key, value);
+ logger.trace("Put into authz cache; key: {}; value: {}", key, value);
}
}
@@ -495,19 +502,23 @@ public class SecurityStoreImpl implements SecurityStore,
HierarchicalRepositoryC
if (authorizationCache == null) {
return null;
} else {
- return authorizationCache.getIfPresent(key);
+ ConcurrentHashSet<SimpleString> value =
authorizationCache.getIfPresent(key);
+ logger.trace("Get from authz cache; key: {}; value: {}", key, value);
+ return value;
}
}
public void invalidateAuthorizationCache() {
if (authorizationCache != null) {
authorizationCache.invalidateAll();
+ logger.trace("Invalidated authz cache");
}
}
public void invalidateAuthenticationCache() {
if (authenticationCache != null) {
authenticationCache.invalidateAll();
+ logger.trace("Invalidated authn cache");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact