Hibernate Search(基于version3.4)--第八章Monitoring

本文介绍了如何通过JMX访问HibernateSearch的统计数据,包括使用StatisticsInfoMBean访问统计数据,利用IndexControlMBean建立、优化和清理索引,以及通过IndexingProgressMonitorMBean跟踪索引进度。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

Monitoring

 

Hibernate Search通过SearchFactory.getStatistics()提供了到Statistics对象的访问。通过Statistics对象,你可以得到一些有用的信息,如:哪些类被索引了或index中有多少个实体类。然而,通过指定hibernate.search.generate_statistics属性,你还可以收集Lucene query的总数或平均数,对象加载时间等。

 

 

8.1. JMX

你也可以通过JMX访问statistics。设置属性hibernate.search.jmx_enabled,便会自动地注册StatisticsInfoMBean。依赖于你的配置,IndexControlMBean和IndexingProgressMonitorMBean会同样被注册。让我们更近距离地看看不同的MBeans。

 

Tip:如果你想通过JConsole远程地访问你的JMX beans,请确保设置system属性 com.sun.management.jmxremote为true。

 

 

8.1.1. StatisticsInfoMBean

 

该MBean使你能访问在之前章节介绍的Statistics对象。

 

8.1.2. IndexControlMBean

该MBean允许去建立,优化和purge某个实体的index。Indexing通过maxx indexing API触发(seeSection 6.3.2, “Using a MassIndexer”)。该bean注册到JMX有一个要求,就是Hibernate的SessionFactory要通过hibernate.session_factory_name属性绑定到JNDI。 IndexControlMBean及其API还在测试阶段。

 

8.1.3. IndexingProgressMonitorMBean

This MBean is an implementation  MassIndexerProgressMonitor interface. If hibernate.search.jmx_enabled is enabled and the mass indexer API is used the indexing progress can be followed via this bean. The bean will only be bound to JMX while indexing is in progress. Once indexing is completed the MBean is not longer available.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值