Examples of AvailabilityType


Examples of org.rhq.core.domain.measurement.AvailabilityType

            }
        }

        // find out what the avail was the last time we checked it. this may be null
        Availability previous = this.inventoryManager.getAvailabilityIfKnown(resource);
        AvailabilityType previousType = (null == previous) ? UNKNOWN : previous.getAvailabilityType();
        AvailabilityType current = null;

        // If the resource's parent is DOWN, the rules are that the resource and all of the parent's other
        // descendants, must also be DOWN. So, there's no need to even ask the resource component
        // for its current availability - its current avail is set to the parent avail type and that's that.
        // Otherwise, checkAvail as needed.
View Full Code Here

Examples of org.rhq.core.domain.measurement.AvailabilityType

                    }
                });

            // prime the pump by getting the first avail synchronously
            System.out.println("~~~AVAILABILITY PROXY CALL #" + 0 + " at " + new Date());
            AvailabilityType firstAvail = ap.getAvailability();
            assert UP.equals(firstAvail) : "Can't even get our first avail correctly: " + firstAvail;
            Mockito.when(resourceContainer.getAvailability()).thenReturn(
                new Availability(new Resource(1), AvailabilityType.UP)); // last avail is UP and will stay as UP

            // make several calls to availProxy.getAvailability() in quick succession
            final int numCalls = 15;
            final Hashtable<String, AvailabilityType> availResults = new Hashtable<String, AvailabilityType>(numCalls);
            final Hashtable<String, Date> dateResults = new Hashtable<String, Date>(numCalls);
            final Hashtable<String, Throwable> throwableResults = new Hashtable<String, Throwable>(numCalls);

            // this will count how many times the proxy actually calls the facet (i.e. component's) getAvail method
            numberOfFacetCalls.set(0);

            // release the hounds!
            for (int i = 1; i <= numCalls; i++) {
                try {
                    // space out the calls slightly to allow some async invocations to complete, giving us a mix of
                    // sync and async completions
                    try {
                        Thread.sleep(25);
                    } catch (InterruptedException e) {
                        //
                    }

                    System.out.println("~~~AVAILABILITY PROXY CALL #" + i + " at " + new Date());
                    AvailabilityType availCheck = ap.getAvailability();
                    // if the avail check is in progress, defer to our last known avail (which should be UP, due to
                    // our first call, and the simulating mock)
                    availCheck = (availCheck == AvailabilityType.UNKNOWN) ? resourceContainer.getAvailability()
                        .getAvailabilityType() : availCheck;
                    availResults.put("Call-" + i, availCheck);
View Full Code Here

Examples of org.rhq.core.domain.measurement.AvailabilityType

        if (LOG.isDebugEnabled()) {
            LOG.debug("Testing proxy call that should complete successfully...");
        }
        resourceComponentProxy = resourceContainer.createResourceComponentProxy(AvailabilityFacet.class,
            FacetLockType.NONE, 2000L, true, false, true);
        AvailabilityType avail = resourceComponentProxy.getAvailability();
        assert (avail == AvailabilityType.UP);
        if (LOG.isDebugEnabled()) {
            LOG.debug("SUCCESS!");
        }
        if (LOG.isDebugEnabled()) {
View Full Code Here

Examples of org.rhq.core.domain.measurement.AvailabilityType

        if (!disabledResource) {
            resourceCounter.tallyResource(resource);

            Availability avail = resourceContainer.getAvailability();
            AvailabilityType availType = null;
            if (avail != null) {
                availType = avail.getAvailabilityType();
            }
            String availString = (availType == null) ? "UNKNOWN" : availType.toString();

            Set<ResourcePackageDetails> installedPackages = resourceContainer.getInstalledPackages();
            int installedPackageCount = installedPackages == null ? 0 : installedPackages.size();

            if (dumpXml) {
View Full Code Here

Examples of org.rhq.core.domain.measurement.AvailabilityType

        System.out.println("---------> " + title);

        for (Set<ResourceContainer> cs : containerSets) {
            for (ResourceContainer c : cs) {
                String name = c.getResource().getName();
                AvailabilityType availType = c.getAvailability().getAvailabilityType();
                String avail = (null == availType) ? null : availType.name();
                Long time = c.getAvailabilityScheduleTime();
                System.out.println("----------> " + name + " " + avail + " " + time);
            }
        }
View Full Code Here

Examples of org.rhq.core.domain.measurement.AvailabilityType

        if (avail.getResourceId() != resourceId)
            throw new IllegalArgumentException("Resource Ids do not match");

        Resource resource = fetchResource(resourceId);

        AvailabilityType at;
        at = AvailabilityType.valueOf(avail.getType());

        // According to jshaughn, plaforms must not be set to DISABLED, so catch this case here.
        if (resource.getResourceType().getCategory()==ResourceCategory.PLATFORM && at==AvailabilityType.DISABLED) {
            throw new BadArgumentException("Availability","Platforms must not be set to DISABLED");
View Full Code Here

Examples of org.rhq.core.domain.measurement.AvailabilityType

                });
        }

        private void refreshAvailability(final CountDownLatch latch) {

            final AvailabilityType currentAvail = resource.getCurrentAvailability().getAvailabilityType();

            GWTServiceLookup.getResourceService().getLiveResourceAvailability(resource.getId(),
                new AsyncCallback<ResourceAvailability>() {

                    @Override
                    public void onFailure(Throwable caught) {

                        availabilityImage.setSrc(ImageManager.getAvailabilityLargeIconFromAvailType(currentAvail));
                        badge.setStyleName("resource-detail-" + currentAvail.getName());
                        if (!UserSessionManager.isLoggedOut()) {
                            CoreGUI.getErrorHandler().handleError(MSG.view_inventory_resource_loadFailed(String.valueOf(resource.getId())), caught);
                        }

                        if (latch != null) {
                            latch.countDown();
                        } else {
                            markForRedraw();
                        }
                    }

                    @Override
                    public void onSuccess(ResourceAvailability result) {
                        availabilityImage.setSrc(ImageManager.getAvailabilityLargeIconFromAvailType(currentAvail));
                        resource.setCurrentAvailability(result);
                        badge.setStyleName("resource-detail-" + currentAvail.getName());

                        availabilityImage.markForRedraw();
                        if (latch != null) {
                            latch.countDown();
                        } else {
View Full Code Here

Examples of org.rhq.core.domain.measurement.AvailabilityType

        } else if (object instanceof PropertySimple) {
            return ((PropertySimple) object).getStringValue();
        } else if (object instanceof ResourceType) {
            return ((ResourceType) object).getName();
        } else if (object instanceof ResourceAvailability) {
            AvailabilityType availType = ((ResourceAvailability) object).getAvailabilityType();
            return (availType == null) ? "?" : availType.getName();
        } else if (object != null && object.getClass().isArray()) {
            return Arrays.toString((Object[]) object);
        } else {
            return stringValueOf(object);
        }
View Full Code Here

Examples of org.rhq.core.domain.measurement.AvailabilityType

        Availability providedValue) {
        if (null == cacheElements) {
            return; // nothing to do
        }

        AvailabilityType availType = providedValue.getAvailabilityType();

        for (AvailabilityDurationCacheElement cacheElement : cacheElements) {
            switch (cacheElement.getAlertConditionOperator()) {
            case AVAIL_DURATION_DOWN:
                if (AvailabilityType.DOWN == availType
View Full Code Here

Examples of org.rhq.core.domain.measurement.AvailabilityType

*/
public class AntiEntropySessionsComponent extends MBeanResourceComponent<JMXComponent<?>> {

    @Override
    public AvailabilityType getAvailability() {
        AvailabilityType availability = super.getAvailability();

        //NOTE: Anti Entropy Sessions resource is up and discoverable
        //      only after running repair and until the next resource
        //      restart. However, keeping the resource in inventory
        //      long term provides good telemetry for the repair operation.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.