[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rhq-commits
Subject:    [rhq] Branch 'feature/cassandra-backend' - 2 commits - modules/enterprise
From:       Jay Shaughnessy <jshaughn () fedoraproject ! org>
Date:       2013-05-29 21:54:25
Message-ID: 20130529215425.BCC9660FEE () fedorahosted ! org
[Download RAW message or body]

 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertTemplateManagerBean.java \
|    8 +++++++-  modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java \
|    9 +++++++++  2 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 8d0d67ac570468da3d31806b10b2e4fa09807207
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Wed May 29 17:53:52 2013 -0400

    Make sure our injected cassandra vm alert template has its relevant
    metric enabled and reported frequently.

diff --git a/modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java \
b/modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java
 index 8704203..ff4ee43 100644
--- a/modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java
                
+++ b/modules/enterprise/server/plugins/alertdef-rhq/src/main/java/org/rhq/enterprise/server/plugins/alertdef/AlertDefinitionServerPluginComponent.java
 @@ -43,6 +43,7 @@ import org.rhq.core.domain.resource.ResourceType;
 import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
 import org.rhq.enterprise.server.alert.AlertTemplateManagerLocal;
 import org.rhq.enterprise.server.auth.SubjectManagerLocal;
+import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal;
 import org.rhq.enterprise.server.plugin.pc.ControlFacet;
 import org.rhq.enterprise.server.plugin.pc.ControlResults;
 import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent;
@@ -257,6 +258,14 @@ public class AlertDefinitionServerPluginComponent implements \
                ServerPluginCompone
         int newTemplateId = \
alertTemplateManager.createAlertTemplate(subjectManager.getOverlord(), newTemplate,  \
resourceType.getId());  
+        // additionally, we want to ensure that the metric is enabled and collecting \
at a more frequent interval than +        // is set by default.
+        MeasurementScheduleManagerLocal measurementManager = \
LookupUtil.getMeasurementScheduleManager(); +        int[] measurementDefinitionIds = \
new int[1]; +        measurementDefinitionIds[0] = \
ac.getMeasurementDefinition().getId(); +        \
measurementManager.updateDefaultCollectionIntervalAndEnablementForMeasurementDefinitions(
 +            subjectManager.getOverlord(), measurementDefinitionIds, 60000L, true, \
true); +
         return newTemplateId;
     }
 


commit 160a6fabeea18fd7410560a8f00206736997adb9
Author: Jay Shaughnessy <jshaughn@redhat.com>
Date:   Wed May 29 17:53:07 2013 -0400

    Fix an issue with alert template application to discovered resources. The
    root cause has to do with sending attached entities across Tx boundaries:
    
      org.hibernate.HibernateException:
      illegally attempted to associate a proxy with two open Sessions

diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertTemplateManagerBean.java \
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertTemplateManagerBean.java
 index 1f8d4e9..2f13b24 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertTemplateManagerBean.java
                
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertTemplateManagerBean.java
 @@ -48,6 +48,8 @@ import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
 import org.rhq.enterprise.server.authz.RequiredPermission;
 import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
 import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
+import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility;
+import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility.SerializationType;
  
 /**
  * @author Joseph Marques
@@ -183,12 +185,16 @@ public class AlertTemplateManagerBean implements \
AlertTemplateManagerLocal {  List<AlertDefinition> unappliedTemplates = \
query.getResultList();  
         for (AlertDefinition template : unappliedTemplates) {
-            // construct the child
+            // construct the child, note that the proxy will pull in lazy data \
                during the copy
             AlertDefinition childAlertDefinition = new AlertDefinition(template);
             childAlertDefinition.setParentId(template.getId());
 
             // persist the child, user is known to be overlord at this point for \
this system side-effect  try {
+                // convert the childAlertDef to a pojo, remove all proxies left over \
from the copy. We can't +                // pass entities across a Tx boundary and \
the call to create the alert def is executed in a new trans. +                \
HibernateDetachUtility +                    \
                .nullOutUninitializedFields(childAlertDefinition, \
                SerializationType.SERIALIZATION);
                 alertDefinitionManager.createAlertDefinitionInNewTransaction(user, \
childAlertDefinition, resourceId,  false);
             } catch (Throwable t) {


_______________________________________________
rhq-commits mailing list
rhq-commits@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/rhq-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic