You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CacheManagers that extend from AbstractTransactionSupportingCacheManager, for example JCacheCacheManager, support transaction awareness by wrapping the Cache in a TransactionAwareCacheDecorator. If enabled, the cache statistics provided by the Spring Boot Actuator project cease to work.
The problem is, that CachePublicMetrics#getCacheStatistics search for a suitable CacheStatisticsProvider by comparing the runtime type of the Cache against the generic type of all registered CacheStatisticsProviders. This, of course, doesn't work if the Cache is wrapped in a completely different type.
As a workaround, I added a new AbstractJmxCacheStatisticsProvider<TransactionAwareCacheDecorator> that contains the same implementation as JCacheCacheStatisticsProvider (because we use JCacheCaches).
We use Spring Boot 1.4.1, but I quickly checked the latest version on Github, and there doesn't seem to be any changes in this area.
I guess CachePublicMetrics#getCacheStatistics should first unwrap TransactionAwareCacheDecorator before trying to lookup a stats provider.
The text was updated successfully, but these errors were encountered:
CachePublicMetrics wasn't explicitly tested and was still using field
injection. This commit improves the situation in preparation of the fix
for gh-8984
CacheManager
s that extend fromAbstractTransactionSupportingCacheManager
, for exampleJCacheCacheManager
, support transaction awareness by wrapping theCache
in aTransactionAwareCacheDecorator
. If enabled, the cache statistics provided by the Spring Boot Actuator project cease to work.The problem is, that
CachePublicMetrics#getCacheStatistics
search for a suitableCacheStatisticsProvider
by comparing the runtime type of theCache
against the generic type of all registeredCacheStatisticsProvider
s. This, of course, doesn't work if the Cache is wrapped in a completely different type.As a workaround, I added a new
AbstractJmxCacheStatisticsProvider<TransactionAwareCacheDecorator>
that contains the same implementation asJCacheCacheStatisticsProvider
(because we useJCacheCache
s).We use Spring Boot 1.4.1, but I quickly checked the latest version on Github, and there doesn't seem to be any changes in this area.
I guess
CachePublicMetrics#getCacheStatistics
should first unwrapTransactionAwareCacheDecorator
before trying to lookup a stats provider.The text was updated successfully, but these errors were encountered: