Package org.rhq.enterprise.server.measurement

Examples of org.rhq.enterprise.server.measurement.AvailabilityManagerLocal


            String reportToString = availabilityReport.toString(false);
            if (log.isDebugEnabled())
                log.debug("Processing " + reportToString);

            long start = System.currentTimeMillis();
            AvailabilityManagerLocal availabilityManager = LookupUtil.getAvailabilityManager();
            boolean ok = availabilityManager.mergeAvailabilityReport(availabilityReport);

            long elapsed = (System.currentTimeMillis() - start);
            if (elapsed > 20000L) {
                log.warn("Performance: processed " + reportToString + " - needFull=[" + !ok + "] in (" + elapsed
                    + ")ms");
View Full Code Here


        return this.invalidPluginConfigurationError;
    }

    public AvailabilityType getAvailabilityType() {
        if (availabilityType == null) {
            AvailabilityManagerLocal manager = LookupUtil.getAvailabilityManager();
            Subject subject = EnterpriseFacesContextUtility.getSubject();
            availabilityType = manager.getCurrentAvailabilityTypeForResource(subject, getId());
        }
        return availabilityType;
    }
View Full Code Here

    @Override
    public ActionForward execute(ComponentContext context, ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
        // Get the resource availability
        AvailabilityManagerLocal availabilityManager = LookupUtil.getAvailabilityManager();
        WebUser user = SessionUtils.getWebUser(request.getSession());
        MeasurementPreferences preferences = user.getMeasurementPreferences();

        int resourceId = RequestUtils.getResourceId(request);
        try {
            MetricRangePreferences rangePreferences = preferences.getMetricRangePreferences();

            List<AvailabilityPoint> data = availabilityManager.findAvailabilitiesForResource(user.getSubject(),
                resourceId, rangePreferences.begin, rangePreferences.end, DefaultConstants.DEFAULT_CHART_POINTS,
                !rangePreferences.readOnly);

            request.setAttribute(AttrConstants.AVAILABILITY_METRICS_ATTR, data);
            request.setAttribute(AttrConstants.AVAIL_METRICS_ATTR, getFormattedAvailability(data));
View Full Code Here

        // resource has initial UNKNOWN ResourceAvailability and no Availability records. simulate an avail report
        // coming from the agent and setting the initial avail to UP.
        AvailabilityReport availReport = new AvailabilityReport(AGENT_NAME);
        availReport.addAvailability(new Datum(resource.getId(), AvailabilityType.UP, System.currentTimeMillis()));
        AvailabilityManagerLocal availManager = LookupUtil.getAvailabilityManager();
        availManager.mergeAvailabilityReport(availReport);

        // wait for our JMS messages to process and see if we get any alerts
        Thread.sleep(3000);

        PageList<Alert> alerts = getAlerts(resource.getId());
        assert alerts.size() == 0 : "No alert should have fired on the initial avail reporting: " + alerts;

        // Now simulate the down avail
        availReport = new AvailabilityReport(AGENT_NAME);
        availReport
            .addAvailability(new Datum(resource.getId(), AvailabilityType.DOWN, System.currentTimeMillis() + 10));
        availManager.mergeAvailabilityReport(availReport);

        // wait for our JMS messages to process and see if we get any alerts
        final PageList<Alert> finalAlerts = alerts;
        timedAssertion(new AssertUtils.BooleanCondition() {
            @Override
View Full Code Here

        // resource has initial UNKNOWN ResourceAvailability and no Availability records. simulate an avail report
        // coming from the agent and setting the initial avail to UP.
        AvailabilityReport availReport = new AvailabilityReport(AGENT_NAME);
        availReport.addAvailability(new Datum(resource.getId(), AvailabilityType.UP, System.currentTimeMillis()));
        AvailabilityManagerLocal availManager = LookupUtil.getAvailabilityManager();
        availManager.mergeAvailabilityReport(availReport);

        // wait for our JMS messages to process and see if we get any alerts
        Thread.sleep(4000);

        PageList<Alert> alerts = getAlerts(resource.getId());
        assert alerts.size() == 0 : "No alert should have fired on the initial avail reporting: " + alerts;

        // Now simulate the down avail
        availReport = new AvailabilityReport(AGENT_NAME);
        availReport
            .addAvailability(new Datum(resource.getId(), AvailabilityType.DOWN, System.currentTimeMillis() + 10));
        availManager.mergeAvailabilityReport(availReport);

        // wait for our JMS messages to process and see if we get any alerts
        Thread.sleep(4000);

        alerts = getAlerts(resource.getId());
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.measurement.AvailabilityManagerLocal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.