<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 19.6.1\. 監測SessionFactory 你可以有兩種方式訪問`SessionFactory`的數據記錄,第一種就是自己直接調用 `sessionFactory.getStatistics()`方法讀取、顯示`統計`數據。 此外,如果你打開`StatisticsService` MBean選項,那么Hibernate則可以使用JMX技術 發布其數據記錄。你可以讓應用中所有的`SessionFactory`同時共享一個MBean,也可以每個 SessionFactory分配一個MBean。下面的代碼即是其演示代碼: ``` // MBean service registration for a specific SessionFactory Hashtable tb = new Hashtable(); tb.put("type", "statistics"); tb.put("sessionFactory", "myFinancialApp"); ObjectName on = new ObjectName("hibernate", tb); // MBean object name StatisticsService stats = new StatisticsService(); // MBean implementation stats.setSessionFactory(sessionFactory); // Bind the stats to a SessionFactory server.registerMBean(stats, on); // Register the Mbean on the server ``` ``` // MBean service registration for all SessionFactory's Hashtable tb = new Hashtable(); tb.put("type", "statistics"); tb.put("sessionFactory", "all"); ObjectName on = new ObjectName("hibernate", tb); // MBean object name StatisticsService stats = new StatisticsService(); // MBean implementation server.registerMBean(stats, on); // Register the MBean on the server ``` TODO:仍需要說明的是:在第一個例子中,我們直接得到和使用MBean;而在第二個例子中,在使用MBean之前 我們則需要給出SessionFactory的JNDI名,使用`hibernateStatsBean.setSessionFactoryJNDIName("my/JNDI/Name")` 得到SessionFactory,然后將MBean保存于其中。 你可以通過以下方法打開或關閉`SessionFactory`的監測功能: * 在配置期間,將`hibernate.generate_statistics`設置為`true`或`false`; * 在運行期間,則可以可以通過`sf.getStatistics().setStatisticsEnabled(true)` 或`hibernateStatsBean.setStatisticsEnabled(true)` 你也可以在程序中調用`clear()`方法重置統計數據,調用`logSummary()` 在日志中記錄(info級別)其總結。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看