- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<?xml version="1.0" encoding="UTF-8"?>
<config
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:jsr107='http://www.ehcache.org/v3/jsr107'
xmlns='http://www.ehcache.org/v3'
xsi:schemaLocation="
http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.1.xsd
http://www.ehcache.org/v3/jsr107 http://www.ehcache.org/schema/ehcache-107-ext-3.1.xsd">
<service>
<jsr107:defaults enable-management="false" enable-statistics="true"/>
</service>
<cache alias="mySlidingExpiryJCache">
<key-type>java.lang.Long</key-type>
<expiry>
<tti unit="seconds">2</tti>
</expiry>
<resources>
<heap unit="entries">200</heap>
</resources>
<jsr107:mbeans enable-statistics="true"/>
</cache>
</config>
我想通过提取 MBean 来显示统计信息,但我不知道如何操作,因为在网上我只能看到以编程方式注入(inject)的 Bean(另请参阅此 SO 问题)。
StatisticsService statisticsService = new DefaultStatisticsService();
CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
.using(statisticsService)
.build();
cacheManager.init();
有什么建议吗?
最佳答案
您启用了 JSR107/JCache 统计信息。这些可以通过 JMX 获得。如果您想以编程方式访问这些 JMX beans,您可以执行以下操作:
Cache cache = // a JSR107 cache
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
ObjectName name = new ObjectName("javax.cache:type=CacheStatistics," +
"CacheManager=" + cache.getCacheManager().getURI().toString() +
",Cache=" + mbeanSafe(cache.getName()));
long hits = mBeanServer.getAttribute(name, "CacheHits");
请注意,JCache Cache
的创建方式与您在问题中的创建方式不同。请参阅此处的详细文档:https://www.ehcache.org/documentation/3.0/107.html
JSR107/JCache 是许多 Java 缓存支持的标准 API。它还包括通过 JMX 公开统计数据。可用指标定义于:https://github.com/jsr107/jsr107spec/blob/master/src/main/java/javax/cache/management/CacheStatisticsMXBean.java
关于java - EhCache 3 : How to unwrap statistics bean?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57669349/
通过 Management Studio 执行 T-SQL 查询时,我可以使用 SET STATISTICS IO ON和 SET STATISTICS TIME ON捕获统计信息以进行查询调整。 当
给定一系列交易 Symbol,Quantity,Price,Side SPY,100,127,Buy SPY,87,125,Sell SPY,109,115,Sell SPY,122,95,Sell
假设您有一个 int 数组(使用具有固定大小 int 的任何语言)。您将如何计算最接近其平均值的 int? 编辑:要清楚,结果不必出现在数组中。也就是说,对于输入数组 [3, 6, 7] 的预期结果是
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
像谷歌新闻这样的新闻媒体如何自动对关于新兴主题的文档进行分类和排名,比如“奥巴马的 2011 年预算”? 我有一堆用棒球数据标记的文章,比如球员姓名和文章的相关性(谢谢,opencalais),我很想
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想要改善这个问题吗?更新问题,以便将其作为on-topi
我需要一个随机数生成器,它以可编程的均值选择指定范围内的数字。 例如,我需要选择2到14之间的数字,并且我需要将随机数的平均值设为5。 我经常使用随机数生成器。通常我只需要一个均匀的分布。 我什至不知
我已经为 IE 6 高对比度模式优化网站并增加字体大小做了很多工作,目的是改善视障人士的体验。但是,在我看来,由于高级浏览器提供的改进的缩放功能,任何有视力障碍的人在升级时都会更加警惕。是否有可用的浏
我有一个包含几个自变量的表,我需要从中计算公式以生成因变量。尽管经过试验,我已经为因变量提出了一个值。 例如,我有一个这样的表: x1 | x2 | x3 || z(value found by ex
我在看 http://lse.sourceforge.net/locking/dcache/dcache_lock.html ,其中测量每个函数的自旋锁时间: SPINLOCKS HO
我正在评估许多不同的算法,它们的工作是预测事件发生的概率。 我正在大型数据集上测试算法。我使用“均方根误差”来衡量它们的有效性,它是((误差总和)平方的平方根)。误差是预测概率(0 和 1 之间的浮点
我有兴趣知道如何根据产品的评级计算排名分数。例如,以苹果应用商店为例。有两个产品 A 和 B。两者的平均评分相同,但 100 位评论者给 A 评分,而 1000 位评论者给 B 评分。直觉上似乎 B
假设我的检索系统的NDCG分数是0.8。我如何解释这个分数。我如何告诉读者这个分数很重要? 最佳答案 NDCG是一种排名指标。在信息检索字段中,您应该预测文档的排序列表,并将它们与相关文档的列表进行比
例如我有两个范围 (1) 0 to 3 (2) 10 to 15 在范围 (1) 中,我有 0 到 3 之间
我想分析一项网络调查的答案(如果有兴趣,Git User's Survey 2008)。一些问题是自由形式的问题,例如“您是如何听说 Git 的?”。有 3,000 多条回复完全靠手工分析这些回复是不
我正在使用 vb.net/asp.net 我的团队创建了一个 Web 应用程序(癌症中心的研究数据库) 我想知道是否有人有关于以编程方式绘制生存曲线的想法 我到处搜索,找不到任何想法 最佳答案 你必须
我正在研究一个需要计算样本协方差矩阵的特征值的问题。 问题是随着时间的推移数据会发生变化(因此样本协方差矩阵)并且需要重新计算特征值。因为特征值的计算成本很高,所以我们想看看是否有任何方法可以更新现有
我正在编写一个程序,显示从财政年度开始到当前日期的当年销售额,与前一年的相同日期范围进行比较。 我的问题是,我需要为闰年做出哪些努力? 更新: 好吧,他们想要它,就像我说的那样(比较去年到同一日期)但
我有一个集合 S={a1,a2,a3,a4,a5,......,an}。每个元素被选中的概率分别是 {p1,p2,p3,p4,p5,...,pn}(当然 p1+p2+p3+p4+p5+....+pn=
我是一名优秀的程序员,十分优秀!