Package org.rioproject.impl.sla

Examples of org.rioproject.impl.sla.SLAPolicyHandler$SLAThresholdEventTask


             */
            WatchDescriptor[] wds = sla.getWatchDescriptors();
            if (wds.length > 0) {
                identifier = wds[0].getName();
            }
            SLAPolicyHandler handler = null;
            ServiceElement elem = context.getServiceElement();
            /* Check if the SLA matches a MeasurableCapability.  */
            MeasurableCapability mCap = getMeasurableCapability(identifier);
            if (mCap != null) {
                logger.trace("[{}] SLA [{}] correlates to a MeasurableCapability", elem.getName(), identifier);
                try {
                    /* Load the SLA PolicyHandler and set attributes */
                    handler = createSLAPolicyHandler(sla, null);

                    ThresholdManager tMgr = new BoundedThresholdManager(mCap.getId());
                    tMgr.setThresholdValues(sla);
                    handler.setThresholdManager(tMgr);
                    mCap.addSecondaryThresholdManager(tMgr);
                    thresholdManagerReg.put(tMgr, mCap);
                    logger.trace("[{}] SLA ID [{}], associated to MeasurableCapability={}, SLAPolicyHandler={}",
                                 elem.getName(), identifier, mCap.getClass().getName(), handler.getClass().getName());
                } catch (Exception e) {
                    logger.warn("Creating SLAPolicyHandler for system SLA [{}]", sla.getIdentifier(), e);
                }

            /* Check if the SLA matches the ThreadDeadlockMonitor. */
 
View Full Code Here


        /* List for new SLAs, that is SLAs that do not have an ID equal to
         * a current Watch */
        ArrayList<SLA> toAddList = new ArrayList<SLA>();
        for (SLA sla : slas) {
            SLAPolicyHandler slap = getSLAPolicyHandler(sla);
            if (slap == null) {
                toAddList.add(sla);
            } else {
                toDiscardList.remove(slap);
                if (SLAPolicyHandlerFactory.slaPolicyHandlerChanged(sla, slap)) {
                    if(logger.isTraceEnabled()) {
                        StringBuilder b = new StringBuilder();
                        b.append("The SLAPolicyHandler for [");
                        b.append(sla.getIdentifier());
                        b.append("] has changed. ");
                        b.append("Configured SLAPolicyHandler=[");
                        b.append(sla.getSlaPolicyHandler());
                        b.append("], SLAPolicyHandler class=[");
                        b.append(slap.getClass().getName());
                        logger.trace(b.toString());
                    }
                    removeSLAPolicyHandler(slap);
                    toAddList.add(sla);
                } else {
                    if(logger.isTraceEnabled()) {
                        StringBuilder b = new StringBuilder();
                        b.append("Updating the SLAPolicyHandler for [");
                        b.append(sla.getIdentifier());
                        b.append("] with new SLA values: ");
                        b.append(sla);                       
                        logger.trace(b.toString());
                    }
                    slap.setSLA(sla);
                    WatchDescriptor[] wds = sla.getWatchDescriptors();
                    for (WatchDescriptor wd : wds) {
                        try {
                            watchInjector.modify(wd);
                        } catch (ConfigurationException e) {
View Full Code Here

     *
     * @throws Exception if the SLAPolicyHandler cannot be created
     */
    private SLAPolicyHandler createSLAPolicyHandler(final SLA sla, final ClassLoader loader)
        throws Exception {
        SLAPolicyHandler slappy = SLAPolicyHandlerFactory.create(sla, proxy, slaEventHandler, context, loader);
        logger.trace("[{}] SLA [{}] Created SLAPolicyHandler [{}]",
                     context.getServiceElement().getName(), sla.getIdentifier(), slappy.getClass().getName());
        slaPolicyHandlers.add(slappy);
        return (slappy);
    }
View Full Code Here

            Collection<ThresholdListener> collection = thresholdListenerTable.get(tWatch.getId());
            for (ThresholdListener tListener : collection) {
                if (logger.isTraceEnabled())
                    logger.trace("Associate Watch [{}] to [{}]", tWatch.getId(), tListener.getClass().getName());
                if (tListener instanceof SLAPolicyHandler) {
                    SLAPolicyHandler slaPolicyHandler = (SLAPolicyHandler)tListener;
                    tWatch.setThresholdValues(slaPolicyHandler.getSLA());
                }
                if(tListener instanceof SettableThresholdListener) {
                    ((SettableThresholdListener)tListener).setThresholdManager(tWatch.getThresholdManager());
                }
            }
View Full Code Here

TOP

Related Classes of org.rioproject.impl.sla.SLAPolicyHandler$SLAThresholdEventTask

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.