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

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.

posted @ 2013-04-30 15:36  眉间尺之魂  阅读(216)  评论(0编辑  收藏  举报