modules/core/domain/src/main/java/org/rhq/core/domain/server/PersistenceUtility.java |
13 ++++++++--
modules/enterprise/gui/portal-war/src/main/webapp/admin/test/control.jsp |
4 +--
2 files changed, 13 insertions(+), 4 deletions(-)
New commits:
commit 079903540828be96bed9f58444bd72e09fe8c93f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Sep 25 16:59:31 2012 -0400
fix control.jsp
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/server/PersistenceUtility.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/server/PersistenceUtility.java
index fa08d88..259c159 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/server/PersistenceUtility.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/server/PersistenceUtility.java
@@ -381,8 +381,9 @@ public class PersistenceUtility {
* @param flag true if the stats are to be enabled; false to disable the
stats
*/
public static void enableHibernateStatistics(EntityManager entityManager, MBeanServer
server, boolean flag) {
+ SessionFactory sessionFactory = null;
try {
- SessionFactory sessionFactory =
PersistenceUtility.getHibernateSession(entityManager).getSessionFactory();
+ sessionFactory =
PersistenceUtility.getHibernateSession(entityManager).getSessionFactory();
if (server == null) {
ArrayList<MBeanServer> list =
MBeanServerFactory.findMBeanServer(null);
@@ -393,12 +394,20 @@ public class PersistenceUtility {
StatisticsService mBean = new StatisticsService();
mBean.setSessionFactory(sessionFactory);
server.registerMBean(mBean, objectName);
- sessionFactory.getStatistics().setStatisticsEnabled(flag);
} catch (InstanceAlreadyExistsException iaee) {
LOG.info("Duplicate mbean registration ignored: " +
HIBERNATE_STATISTICS_MBEAN_OBJECTNAME);
} catch (Exception e) {
LOG.warn("Couldn't register hibernate statistics mbean", e);
}
+
+ try {
+ if (sessionFactory != null) {
+ sessionFactory.getStatistics().setStatisticsEnabled(flag);
+ LOG.info("Hibernate statistics enable flag set to [" + flag +
"]");
+ }
+ } catch (Exception e) {
+ LOG.warn("Couldn't set the statistics enable flag to [" + flag
+ "]", e);
+ }
}
public static Statistics getStatisticsService(EntityManager entityManager,
MBeanServer server) {
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/control.jsp
b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/control.jsp
index 163571c..13bfd17 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/control.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/control.jsp
@@ -83,7 +83,7 @@
systemManager.analyze(subjectManager.getOverlord());
result += "DB analyze done";
}
- else if ("errorCorrectSchedules".equals("mode"))
+ else if ("errorCorrectSchedules".equals(mode))
{
measurementScheduleManager.errorCorrectSchedules();
result = "Measurement schedules checked for invalid (too low) intervals and
corrected if need be";
@@ -99,7 +99,7 @@
else if ("getMeasurementTableStats".equals(mode))
{
resultNoEscape = "<table>";
- Map<String, Long> tableCounts =
coreTestBean.getMeasurementTableStats()();
+ Map<String, Long> tableCounts = coreTestBean.getMeasurementTableStats();
for (Map.Entry<String, Long> nextCount : tableCounts.entrySet()) {
String tableAlias = nextCount.getKey();
Long tableCount = nextCount.getValue();
Show replies by date