Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 832706 Details for
Bug 1037855
remove avail async API from plugins
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
more comprehensive patch
bz1037855.patch (text/plain), 68.09 KB, created by
John Mazzitelli
on 2013-12-04 15:21:17 UTC
(
hide
)
Description:
more comprehensive patch
Filename:
MIME Type:
Creator:
John Mazzitelli
Created:
2013-12-04 15:21:17 UTC
Size:
68.09 KB
patch
obsolete
>diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/availability/AvailabilityCollectorRunnable.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/availability/AvailabilityCollectorRunnable.java >index 5ce5bd7..3fe01ab 100644 >--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/availability/AvailabilityCollectorRunnable.java >+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/availability/AvailabilityCollectorRunnable.java >@@ -23,94 +23,15 @@ > package org.rhq.core.pluginapi.availability; > > import java.util.concurrent.Executor; >-import java.util.concurrent.atomic.AtomicBoolean; >-import java.util.concurrent.atomic.AtomicReference; >- >-import org.apache.commons.logging.Log; >-import org.apache.commons.logging.LogFactory; > > import org.rhq.core.domain.measurement.AvailabilityType; >-import org.rhq.core.util.exception.ThrowableUtil; > > /** >- * A class that can be used by plugins whose components may not be able to collect availability statuses fast enough. >- * >- * Typically, availability checks are very fast (sub-second). However, the plugin container puts a time limit >- * on how long it will wait for a plugin's resource component to return availability status from calls to >- * {@link AvailabilityFacet#getAvailability()}. This time limit is typically on the order of several seconds. >- * The purpose of this time limit is to avoid having a rogue or misbehaving plugin from causing delays in availability >- * reporting for the rest of the resources being managed within the system. >- * >- * This class provides an implementation to help resource components that can't guarantee how fast its >- * availability checks will be. Some managed resources simply can't respond to availability checks fast enough. In this >- * case, this class will provide an asynchronous method that will collect availability without a timeout being involved >- * (in other words, availability will be retrieved by waiting as long as it takes). In order to tell the plugin container >- * what the managed resource's current availability is, this class will provide a fast method to return the last known >- * availability of the resource. In other words, it will be able to return the last know availability that was last retrieved >- * by the asynchronous task - this retrieval of the last known availability will be very fast. >- * >- * @since 1.3 >- * @author John Mazzitelli >+ * @deprecated this is no longer necessary in 4.10+ since the plugin container makes all avail checks asynchronous now > */ >+@Deprecated() > public class AvailabilityCollectorRunnable implements Runnable { >- private static final Log log = LogFactory.getLog(AvailabilityCollectorRunnable.class); >- >- /** >- * The minimum interval allowed between availability checks, in milliseconds. >- */ >- public static final long MIN_INTERVAL = 60000L; >- >- /** >- * The thread pool to give this runnable a thread to run in when it needs to check availability. >- */ >- private final Executor threadPool; >- >- /** >- * If <code>true</code>, this collector runnable should be actively polling the resource for availability status. >- */ >- private final AtomicBoolean started = new AtomicBoolean(false); >- >- /** >- * The classloader to be used when checking availability. >- */ >- private final ClassLoader contextClassloader; >- >- /** >- * The object that is used to check the availability for the managed resource. >- */ > private final AvailabilityFacet availabilityChecker; >- >- /** >- * The time, in milliseconds, that this collector will pause in between availability checks. >- */ >- private final long interval; >- >- /** >- * The last known availability for the resource that this collector is monitoring. >- */ >- private AtomicReference<AvailabilityType> lastKnownAvailability = new AtomicReference<AvailabilityType>(); >- >- /** >- * Just a cache of the facet toString used in log messages. We don't want to keep calling toString on the >- * facet for fear we might get some odd blocking or exceptions thrown. So we call it once and cache it here. >- */ >- private final String facetId; >- >- /** >- * Creates a collector instance that will perform availability checking for a particular managed resource. >- * >- * The interval is the time, in milliseconds, this collector will wait between availability checks. >- * This is the amount of time this collector will sleep after each time an availability >- * check returned with the latest status. A typically value should be something around 1 minute >- * but if an availability check takes alot of system resources to perform or adversely affects the >- * managed resource if performed too often, you can make this longer. >- * The shortest value allowed, however, is {@link #MIN_INTERVAL}. >- * >- * @param availabilityChecker the object that is used to periodically check the managed resource (must not be <code>null</code>) >- * @param interval the interval, in millis, between checking availabilities. >- * @param contextClassloader the context classloader that will be used when checking availability >- * @param threadPool the thread pool to be used to submit this runnable when it needs to start >- */ > public AvailabilityCollectorRunnable(AvailabilityFacet availabilityChecker, long interval, > ClassLoader contextClassloader, Executor threadPool) { > >@@ -118,100 +39,20 @@ public class AvailabilityCollectorRunnable implements Runnable { > throw new IllegalArgumentException("availabilityChecker is null"); > } > >- if (threadPool == null) { >- throw new IllegalArgumentException("threadPool is null"); >- } >- >- if (interval < MIN_INTERVAL) { >- log.info("Interval is too short [" + interval + "] - setting to minimum of [" + MIN_INTERVAL + "]"); >- interval = MIN_INTERVAL; >- } >- >- if (contextClassloader == null) { >- contextClassloader = Thread.currentThread().getContextClassLoader(); >- } >- >- this.threadPool = threadPool; > this.availabilityChecker = availabilityChecker; >- this.contextClassloader = contextClassloader; >- this.interval = interval; >- this.lastKnownAvailability.set(AvailabilityType.DOWN); >- this.facetId = availabilityChecker.toString(); > } > >- /** >- * This returns the last known availability status that was most recently retrieved from the managed resource. >- * This will not perform a live check on the managed resource; instead, it immediately returns the last known >- * state of the managed resource. For those resource components using this availability collector utility, >- * their {@link AvailabilityFacet#getAvailability()} method should simply be calling this method. >- * >- * @return {@link AvailabilityType#UP} if the resource can be accessed; otherwise {@link AvailabilityType#DOWN} >- */ > public AvailabilityType getLastKnownAvailability() { >- return this.lastKnownAvailability.get(); >+ // this deprecated class will fall back to doing a sync call >+ return this.availabilityChecker.getAvailability(); > } > >- /** >- * For those resource components using this availability collector utility, >- * their {@link org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext)} method must call this >- * to start the availability checking that this object performs. >- */ > public void start() { >- boolean isStarted = (this.started.getAndSet(true)); >- if (isStarted) { >- log.debug("Availability collector runnable [" + this.facetId + "] is already started"); >- } else { >- this.threadPool.execute(this); >- log.debug("Availability collector runnable [" + this.facetId + "] submitted to thread pool"); >- } > } > >- /** >- * For those resource components using this availability collector utility, >- * their {@link org.rhq.core.pluginapi.inventory.ResourceComponent#stop()} method must call this >- * to stop the availability checking that this object performs. >- */ > public void stop() { >- this.started.set(false); >- log.debug("Availability collector runnable [" + this.facetId + "] was told to stop"); > } > >- /** >- * Performs the actual availability checking. This is the method that is invoked >- * after this runnable is {@link #start() submitted to the thread pool}. >- * You should not be calling this method directly - use {@link #start()} instead. >- */ > public void run() { >- log.debug("Availability collector runnable [" + this.facetId + "] started"); >- >- ClassLoader originalClassloader = Thread.currentThread().getContextClassLoader(); >- Thread.currentThread().setContextClassLoader(this.contextClassloader); >- >- try { >- // while we are still running, we need to sleep then get the new availability >- do { >- try { >- AvailabilityType availability = this.availabilityChecker.getAvailability(); >- this.lastKnownAvailability.set(availability); >- } catch (Throwable t) { >- log.warn("Availability collector [" + this.facetId >- + "] failed to get availability - keeping the last known availability of [" >- + this.lastKnownAvailability.get() + "]. Cause: " + ThrowableUtil.getAllMessages(t)); >- } >- >- try { >- Thread.sleep(this.interval); >- } catch (InterruptedException e) { >- // we got interrupted, we assume we need to shutdown >- this.started.set(false); >- log.debug("Availability collector [" + this.facetId + "] interrupted"); >- } >- } while (this.started.get()); >- } finally { >- Thread.currentThread().setContextClassLoader(originalClassloader); >- } >- >- log.debug("Availability collector runnable [" + this.facetId + "] stopped"); >- return; > } > } >diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/availability/AvailabilityContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/availability/AvailabilityContext.java >index a6f90b4..37ef4d6 100644 >--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/availability/AvailabilityContext.java >+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/availability/AvailabilityContext.java >@@ -21,8 +21,6 @@ > package org.rhq.core.pluginapi.availability; > > import org.rhq.core.domain.measurement.AvailabilityType; >-import org.rhq.core.pluginapi.inventory.ResourceComponent; >-import org.rhq.core.pluginapi.inventory.ResourceContext; > > /** > * Resource specific context through which to make availability related calls back into the plugin container. >@@ -32,30 +30,9 @@ import org.rhq.core.pluginapi.inventory.ResourceContext; > public interface AvailabilityContext { > > /** >- * Under certain circumstances, a resource component may want to perform asynchronous availability checks, as >- * opposed to {@link AvailabilityFacet#getAvailability()} blocking waiting for the managed resource to return >- * its availability status. Using asynchronous availability checking frees the resource component from having >- * to guarantee that the managed resource will provide availability status in a timely fashion. >- * >- * If the resource component needs to perform asynchronous availability checking, it should call this >- * method to create an instance of {@link AvailabilityCollectorRunnable} inside the {@link ResourceComponent#start} method. >- * It should then call the returned object's {@link AvailabilityCollectorRunnable#start()} method within the same resource >- * component {@link ResourceComponent#start(ResourceContext)} method. The resource component should call the >- * {@link AvailabilityCollectorRunnable#stop()} method when the resource component >- * {@link ResourceComponent#stop() stops}. The resource component's {@link AvailabilityFacet#getAvailability()} method >- * should simply return the value returned by {@link AvailabilityCollectorRunnable#getLastKnownAvailability()}. This >- * method will be extremely fast since it simply returns the last availability that was retrieved by the >- * given availability checker. Only when the availability checker finishes checking for availability of the managed resource >- * (however long it takes to do so) will the last known availability state change. >- * >- * For more information, read the javadoc in {@link AvailabilityCollectorRunnable}. >- * >- * @param availChecker the object that will perform the actual check of the managed resource's availability >- * @param interval the interval, in milliseconds, between availability checks. The minimum value allowed >- * for this parameter is {@link AvailabilityCollectorRunnable#MIN_INTERVAL}. >- * >- * @return the availability collector runnable that will perform the asynchronous checking >+ * @deprecated this is no longer useful - all resources' avail checks are async since 4.10 > */ >+ @Deprecated > public AvailabilityCollectorRunnable createAvailabilityCollectorRunnable(AvailabilityFacet availChecker, > long interval); > >@@ -64,7 +41,7 @@ public interface AvailabilityContext { > * metric. At times the plugin may want the PC to request an availability check be done prior to the next > * scheduled check time. For example, Start/Stop/Restart operation implementations may want to request that the PC > * check availability sooner rather than later, to pick up the new lifecycle state. This method should be used >- * sparingly, and should not in general override the scheduled avail checks. >+ * sparingly, and should not in general override the scheduled avail checks. > */ > public void requestAvailabilityCheck(); > >@@ -72,7 +49,7 @@ public interface AvailabilityContext { > * This method will return the last reported AvailabilityType, which can be null if not yet reported. This > * method *does not* invoke a call to {link {@link AvailabilityFacet#getAvailability()}, raher it will return > * the result of the most recent call to that method, made by the plugin container. >- * >+ * > * @return the last reported availability type, or null if not yet reported. > */ > public AvailabilityType getLastReportedAvailability(); >@@ -83,7 +60,7 @@ public interface AvailabilityContext { > * that alerting and availability reporting will essentionally be ignored for the resource until it is > * again enabled. A user is free to enable a resource disabled by the component code. If the resource is > * already disabled then the call has no effect. >- * >+ * > * @see {@link #enable()} > */ > public void disable(); >@@ -93,7 +70,7 @@ public interface AvailabilityContext { > * a user can set a resource ENABLED. This should be used with care by component code as it does not care > * how the resource was DISABLED. It can override a user action. If the resource is already disabled then > * the call has no effect. >- * >+ * > * @see {@link #disable()} > */ > public void enable(); >diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/availability/AvailabilityCollectorThreadPool.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/availability/AvailabilityCollectorThreadPool.java >deleted file mode 100644 >index c4951d9..0000000 >--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/availability/AvailabilityCollectorThreadPool.java >+++ /dev/null >@@ -1,105 +0,0 @@ >-/* >- * RHQ Management Platform >- * Copyright (C) 2005-2008 Red Hat, Inc. >- * All rights reserved. >- * >- * This program is free software; you can redistribute it and/or modify >- * it under the terms of the GNU General Public License, version 2, as >- * published by the Free Software Foundation, and/or the GNU Lesser >- * General Public License, version 2.1, also as published by the Free >- * Software Foundation. >- * >- * This program is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >- * GNU General Public License and the GNU Lesser General Public License >- * for more details. >- * >- * You should have received a copy of the GNU General Public License >- * and the GNU Lesser General Public License along with this program; >- * if not, write to the Free Software Foundation, Inc., >- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. >- */ >-package org.rhq.core.pc.availability; >- >-import java.util.concurrent.Executor; >-import java.util.concurrent.ExecutorService; >-import java.util.concurrent.Executors; >-import java.util.concurrent.ThreadFactory; >- >-import org.apache.commons.logging.Log; >-import org.apache.commons.logging.LogFactory; >- >-import org.rhq.core.pc.PluginContainer; >-import org.rhq.core.pc.util.LoggingThreadFactory; >-import org.rhq.core.pluginapi.availability.AvailabilityCollectorRunnable; >- >-/** >- * A utility class that can be used by plugins whose components may not be able to collect availability statuses >- * fast enough. This thread pool object can be used to submit {@link AvailabilityCollectorRunnable} instances, >- * each of which will be used to collect availability statuses for a managed resource. >- * >- * This class is used in conjunction with instances of {@link AvailabilityCollectorRunnable} - read its javadoc for more. >- * >- * @author John Mazzitelli >- */ >-public class AvailabilityCollectorThreadPool implements Executor { >- private static final Log log = LogFactory.getLog(AvailabilityCollectorThreadPool.class); >- >- /** >- * To avoid many plugins/components needing to spawn their own thread pools/threads, this >- * will allow everyone to reuse the same thread pool. This thread pool will be allowed to grow as needed, >- * but will reuse threads when they become available. >- */ >- private ExecutorService threadPool; >- >- public void initialize() { >- synchronized (this) { >- if (threadPool == null) { >- log.debug("Initializing AvailabilityCollector thread pool"); >- ThreadFactory daemonFactory = new LoggingThreadFactory("AvailabilityCollector", true); >- threadPool = Executors.newCachedThreadPool(daemonFactory); >- } >- } >- return; >- } >- >- public void shutdown() { >- >- synchronized (this) { >- if (threadPool != null) { >- log.debug("Shutting down AvailabilityCollector thread pool..."); >- PluginContainer pluginContainer = PluginContainer.getInstance(); >- pluginContainer.shutdownExecutorService(threadPool, true); >- threadPool = null; >- } >- } >- return; >- } >- >- /** >- * Given a {@link AvailabilityCollectorRunnable} instance, this will run that instance in a thread, thus >- * allowing the availability status for a managed resource to be periodically checked asynchronously. The >- * given runnable will store its last known availability status so it can be retrieved very fast. >- * >- * The given runnable must be of type {@link AvailabilityCollectorRunnable}, otherwise a runtime exception will occur. >- * >- * @param runnable the availability collector runnable that will be invoked in a thread to being collecting >- * availability status of a managed resource. >- */ >- public void execute(Runnable runnable) { >- if (runnable instanceof AvailabilityCollectorRunnable) { >- synchronized (this) { >- if (threadPool != null) { >- threadPool.execute(runnable); >- } >- } >- return; >- } else if (runnable == null) { >- throw new NullPointerException("runnable == null"); >- } else { >- throw new IllegalArgumentException("Runnable is of type [" + runnable.getClass() + "]; must be of type [" >- + AvailabilityCollectorRunnable.class + "]"); >- } >- } >-} >diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/availability/AvailabilityContextImpl.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/availability/AvailabilityContextImpl.java >index 32fb361..2919014 100644 >--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/availability/AvailabilityContextImpl.java >+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/availability/AvailabilityContextImpl.java >@@ -20,8 +20,6 @@ > > package org.rhq.core.pc.availability; > >-import java.util.concurrent.Executor; >- > import org.rhq.core.domain.measurement.Availability; > import org.rhq.core.domain.measurement.AvailabilityType; > import org.rhq.core.domain.resource.Resource; >@@ -36,29 +34,20 @@ import org.rhq.core.pluginapi.availability.AvailabilityFacet; > public class AvailabilityContextImpl implements AvailabilityContext { > > private final Resource resource; >- private final Executor availCollectionThreadPool; > >- public AvailabilityContextImpl(Resource resource, Executor availCollectionThreadPool) { >+ public AvailabilityContextImpl(Resource resource) { > super(); > this.resource = resource; >- this.availCollectionThreadPool = availCollectionThreadPool; > } > >- /* (non-Javadoc) >- * @see org.rhq.core.pluginapi.availability.AvailabilityContext#createAvailabilityCollectorRunnable(org.rhq.core.pluginapi.availability.AvailabilityFacet, long) >- */ > @Override >- public AvailabilityCollectorRunnable createAvailabilityCollectorRunnable(AvailabilityFacet availChecker, >- long interval) { >- >- // notice that we assume we are called with the same context classloader that will be need by the avail checker >- return new AvailabilityCollectorRunnable(availChecker, interval, >- Thread.currentThread().getContextClassLoader(), this.availCollectionThreadPool); >+ @Deprecated >+ public AvailabilityCollectorRunnable createAvailabilityCollectorRunnable(AvailabilityFacet facet, long i) { >+ // even though this shouldn't be used, plugins may still be using this. Allow for these to still be >+ // created for backward compatibility, but its a dummy object nevertheless. >+ return new AvailabilityCollectorRunnable(facet, i, null, null); > } > >- /* (non-Javadoc) >- * @see org.rhq.core.pluginapi.availability.AvailabilityContext#requestAvailabilityCheck() >- */ > @Override > public void requestAvailabilityCheck() { > PluginContainer.getInstance().getInventoryManager().requestAvailabilityCheck(resource); >diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java >index 5b01a26..35ba2af 100644 >--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java >+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java >@@ -89,7 +89,6 @@ import org.rhq.core.pc.PluginContainerConfiguration; > import org.rhq.core.pc.ServerServices; > import org.rhq.core.pc.agent.AgentRegistrar; > import org.rhq.core.pc.agent.AgentService; >-import org.rhq.core.pc.availability.AvailabilityCollectorThreadPool; > import org.rhq.core.pc.availability.AvailabilityContextImpl; > import org.rhq.core.pc.component.ComponentInvocationContextImpl; > import org.rhq.core.pc.content.ContentContextImpl; >@@ -215,11 +214,6 @@ public class InventoryManager extends AgentService implements ContainerService, > private DiscoveryComponentProxyFactory discoveryComponentProxyFactory; > > /** >- * Used by resource components that want to perform asynchronous availability checking. >- */ >- private AvailabilityCollectorThreadPool availabilityCollectors; >- >- /** > * Handles the resource upgrade during the initialization of the inventory manager. > */ > private ResourceUpgradeDelegate resourceUpgradeDelegate = new ResourceUpgradeDelegate(this); >@@ -242,11 +236,6 @@ public class InventoryManager extends AgentService implements ContainerService, > > this.agent = new Agent(this.configuration.getContainerName(), null, 0, null, null); > >- //make sure the avail collectors are available before we instantiate any >- //resource context - either from disk or from anywhere else. >- availabilityCollectors = new AvailabilityCollectorThreadPool(); >- availabilityCollectors.initialize(); >- > if (configuration.isInsideAgent()) { > loadFromDisk(); > } >@@ -306,7 +295,6 @@ public class InventoryManager extends AgentService implements ContainerService, > this.persistToDisk(); > } > this.discoveryComponentProxyFactory.shutdown(); >- this.availabilityCollectors.shutdown(); > this.inventoryEventListeners.clear(); > this.resourceContainersByUUID.clear(); > this.resourceContainerByResourceId.clear(); >@@ -1977,7 +1965,7 @@ public class InventoryManager extends AgentService implements ContainerService, > getEventContext(resource), // for event access > getOperationContext(resource), // for operation manager access > getContentContext(resource), // for content manager access >- getAvailabilityContext(resource, this.availabilityCollectors), // for components that want to perform async avail checking >+ getAvailabilityContext(resource), > getInventoryContext(resource), this.configuration.getPluginContainerDeployment(), // helps components make determinations of what to do > new ComponentInvocationContextImpl()); > } >@@ -1997,7 +1985,7 @@ public class InventoryManager extends AgentService implements ContainerService, > getEventContext(resource), // for event access > getOperationContext(resource), // for operation manager access > getContentContext(resource), // for content manager access >- getAvailabilityContext(resource, this.availabilityCollectors), // for components that want avail manager access >+ getAvailabilityContext(resource), // for components that want avail manager access > getInventoryContext(resource), this.configuration.getPluginContainerDeployment()); // helps components make determinations of what to do > } > >@@ -2815,12 +2803,12 @@ public class InventoryManager extends AgentService implements ContainerService, > // }; > // } > >- private AvailabilityContext getAvailabilityContext(Resource resource, Executor availCollectionThreadPool) { >+ private AvailabilityContext getAvailabilityContext(Resource resource) { > if (null == resource.getUuid() || resource.getUuid().isEmpty()) { > log.error("RESOURCE UUID IS NOT SET! Availability features may not work!"); > } > >- AvailabilityContext availabilityContext = new AvailabilityContextImpl(resource, availCollectionThreadPool); >+ AvailabilityContext availabilityContext = new AvailabilityContextImpl(resource); > return availabilityContext; > } > >diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/availability/AvailabilityCollectorTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/availability/AvailabilityCollectorTest.java >deleted file mode 100644 >index ec0538b..0000000 >--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/availability/AvailabilityCollectorTest.java >+++ /dev/null >@@ -1,88 +0,0 @@ >-/* >- * RHQ Management Platform >- * Copyright (C) 2005-2008 Red Hat, Inc. >- * All rights reserved. >- * >- * This program is free software; you can redistribute it and/or modify >- * it under the terms of the GNU General Public License, version 2, as >- * published by the Free Software Foundation, and/or the GNU Lesser >- * General Public License, version 2.1, also as published by the Free >- * Software Foundation. >- * >- * This program is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >- * GNU General Public License and the GNU Lesser General Public License >- * for more details. >- * >- * You should have received a copy of the GNU General Public License >- * and the GNU Lesser General Public License along with this program; >- * if not, write to the Free Software Foundation, Inc., >- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. >- */ >-package org.rhq.core.pc.availability; >- >-import org.testng.annotations.AfterTest; >-import org.testng.annotations.BeforeTest; >-import org.testng.annotations.Test; >- >-import org.rhq.core.domain.measurement.AvailabilityType; >-import org.rhq.core.pluginapi.availability.AvailabilityCollectorRunnable; >-import org.rhq.core.pluginapi.availability.AvailabilityFacet; >- >-@Test >-public class AvailabilityCollectorTest { >- >- private AvailabilityCollectorThreadPool threadPool; >- >- @BeforeTest >- public void beforeTest() { >- threadPool = new AvailabilityCollectorThreadPool(); >- threadPool.initialize(); >- } >- >- @AfterTest >- public void afterTest() { >- threadPool.shutdown(); >- threadPool = null; >- } >- >- public void testCollector() throws Exception { >- >- AvailabilityType[] avail = new AvailabilityType[] { AvailabilityType.UP }; >- TestAvailabilityFacet component = new TestAvailabilityFacet(avail); >- AvailabilityCollectorRunnable runnable = new AvailabilityCollectorRunnable(component, 60000L, null, >- this.threadPool); >- runnable.start(); >- Thread.sleep(1000L); >- assert AvailabilityType.UP == runnable.getLastKnownAvailability(); >- >- // availability collector cannot allow for collections faster than 60s. So we can't have tests faster than this. >- // set this if-check to true to fully test the collector (which takes a couple mins of wait time to complete) >- if (System.getProperty("AvailabilityCollectorTest.longtest", "false").equals("true")) { >- avail[0] = AvailabilityType.DOWN; >- System.out.println("~~~~~~~~~~sleeping for 60 secs"); >- Thread.sleep(60100L); >- assert AvailabilityType.DOWN == runnable.getLastKnownAvailability() : "Collector should have seen the change"; >- >- runnable.stop(); >- avail[0] = AvailabilityType.UP; >- System.out.println("~~~~~~~~~~sleeping for 60 secs"); >- Thread.sleep(60100L); >- assert AvailabilityType.DOWN == runnable.getLastKnownAvailability() : "Collector should have stopped and not see the change"; >- } >- } >- >- protected class TestAvailabilityFacet implements AvailabilityFacet { >- private AvailabilityType[] avail; >- >- public TestAvailabilityFacet(AvailabilityType[] avail) { >- this.avail = avail; >- } >- >- public AvailabilityType getAvailability() { >- System.out.println("~~~~~~~~~~" + new java.util.Date() + " == " + this.avail[0]); >- return this.avail[0]; >- } >- } >-} >diff --git a/modules/plugins/database/src/test/java/org/rhq/plugins/database/ComponentTest.java b/modules/plugins/database/src/test/java/org/rhq/plugins/database/ComponentTest.java >index 050aa2e..6caba36 100644 >--- a/modules/plugins/database/src/test/java/org/rhq/plugins/database/ComponentTest.java >+++ b/modules/plugins/database/src/test/java/org/rhq/plugins/database/ComponentTest.java >@@ -19,13 +19,16 @@ import java.util.LinkedHashMap; > import java.util.List; > import java.util.Map; > import java.util.Set; >-import java.util.concurrent.Executor; >-import java.util.concurrent.Executors; > > import javax.xml.bind.JAXBElement; > > import org.apache.commons.logging.Log; > import org.apache.commons.logging.LogFactory; >+import org.testng.annotations.AfterSuite; >+import org.testng.annotations.AfterTest; >+import org.testng.annotations.BeforeClass; >+import org.testng.annotations.BeforeSuite; >+ > import org.rhq.core.clientapi.agent.metadata.PluginMetadataManager; > import org.rhq.core.clientapi.descriptor.AgentPluginDescriptorUtil; > import org.rhq.core.clientapi.descriptor.configuration.ConfigurationProperty; >@@ -73,10 +76,6 @@ import org.rhq.core.system.ProcessInfo; > import org.rhq.core.system.SystemInfo; > import org.rhq.core.system.SystemInfoFactory; > import org.rhq.core.system.pquery.ProcessInfoQuery; >-import org.testng.annotations.AfterSuite; >-import org.testng.annotations.AfterTest; >-import org.testng.annotations.BeforeClass; >-import org.testng.annotations.BeforeSuite; > > /** > * Base class for RHQ Component Testing. >@@ -136,7 +135,6 @@ public abstract class ComponentTest { > private final String pluginContainerName = "rhq"; > private final OperationContext operationContext = new OperationContextImpl(0); > private final ContentContext contentContext = new ContentContextImpl(0); >- private final Executor availCollectorThreadPool = Executors.newCachedThreadPool(); > private PluginContainerDeployment pluginContainerDeployment = null; > private Resource platform; > private ResourceContainer platformContainer; >@@ -279,7 +277,7 @@ public abstract class ComponentTest { > String rclassname = pmm.getComponentClass(type); > ResourceComponent component = (ResourceComponent) Class.forName(rclassname).newInstance(); > >- availabilityContext = new AvailabilityContextImpl(cresource,availCollectorThreadPool); >+ availabilityContext = new AvailabilityContextImpl(cresource); > inventoryContext = new InventoryContextImpl(cresource); > > EventContext eventContext = new EventContextImpl(resource); >diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java >index fb8bd27..67ae62d 100644 >--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java >+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java >@@ -72,8 +72,6 @@ import org.rhq.core.domain.measurement.MeasurementDataNumeric; > import org.rhq.core.domain.measurement.MeasurementDataTrait; > import org.rhq.core.domain.measurement.MeasurementReport; > import org.rhq.core.domain.measurement.MeasurementScheduleRequest; >-import org.rhq.core.pluginapi.availability.AvailabilityCollectorRunnable; >-import org.rhq.core.pluginapi.availability.AvailabilityFacet; > import org.rhq.core.pluginapi.configuration.ConfigurationFacet; > import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport; > import org.rhq.core.pluginapi.content.ContentContext; >@@ -135,17 +133,7 @@ public class ApplicationServerComponent<T extends ResourceComponent<?>> implemen > private LogFileEventResourceComponentHelper logFileEventDelegate; > private CreateChildResourceFacetDelegate createChildResourceDelegate; > >- private AvailabilityCollectorRunnable availCollector; >- > public AvailabilityType getAvailability() { >- if (this.availCollector != null) { >- return this.availCollector.getLastKnownAvailability(); >- } else { >- return getAvailabilityNow(); >- } >- } >- >- private AvailabilityType getAvailabilityNow() { > connectToProfileService(); > AvailabilityType availability; > if (this.connection != null) { >@@ -200,35 +188,10 @@ public class ApplicationServerComponent<T extends ResourceComponent<?>> implemen > > this.createChildResourceDelegate = new CreateChildResourceFacetDelegate(this, this.getResourceContext()); > >- // prepare to perform async avail checking >- Configuration pc = resourceContext.getPluginConfiguration(); >- String availCheckPeriodProp = pc.getSimpleValue( >- ApplicationServerPluginConfigurationProperties.AVAIL_CHECK_PERIOD_CONFIG_PROP, null); >- if (availCheckPeriodProp != null) { >- try { >- long availCheckMillis = Integer.parseInt(availCheckPeriodProp) * 1000L; >- this.availCollector = resourceContext.getAvailabilityContext().createAvailabilityCollectorRunnable( >- new AvailabilityFacet() { >- public AvailabilityType getAvailability() { >- return getAvailabilityNow(); >- } >- }, availCheckMillis); >- this.availCollector.start(); >- } catch (NumberFormatException nfe) { >- log.error("avail check period config prop was not a valid number. Cause: " + nfe); >- this.availCollector = null; >- } >- } >- > return; > } > > public void stop() { >- if (this.availCollector != null) { >- this.availCollector.stop(); >- this.availCollector = null; >- } >- > this.logFileEventDelegate.stopLogFileEventPollers(); > disconnectFromProfileService(); > this.jmxConnectionHelper.closeConnection(); >diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java >index c770844..7c30135 100644 >--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java >+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerPluginConfigurationProperties.java >@@ -45,7 +45,6 @@ public class ApplicationServerPluginConfigurationProperties { > public static final String SHUTDOWN_MBEAN_OPERATION_CONFIG_PROP = "shutdownMBeanOperation"; > public static final String SHUTDOWN_METHOD_CONFIG_PROP = "shutdownMethod"; > public static final String SCRIPT_PREFIX_CONFIG_PROP = "scriptPrefix"; >- public static final String AVAIL_CHECK_PERIOD_CONFIG_PROP = "availabilityCheckPeriod"; > > private ApplicationServerPluginConfigurationProperties() { > } >diff --git a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml >index e213719..306aed6 100644 >--- a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml >+++ b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml >@@ -1029,13 +1029,6 @@ > description="Name of the operation to invoke when shutting down this server through JMX. > Note that only operations with no parameter or with one int parameter are supported. If the > operation requires an int parameter, '0' will be supplied." /> >- <c:simple-property name="availabilityCheckPeriod" >- description="The amount of time, in seconds, that must elapse between availability checks to see if the server is up. If set, the availability checks will be performed asynchronously thus allowing slow-responding servers to avoid being falsely reported as down." >- units="seconds" required="false" type="integer"> >- <c:constraint> >- <c:integer-constraint minimum="60" /> >- </c:constraint> >- </c:simple-property> > > <c:simple-property name="serviceAvailabilityRefreshInterval" units="minutes" required="false" > default="15" type="integer" >diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java >index 944d7c5..5e2f272 100644 >--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java >+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java >@@ -43,8 +43,6 @@ import org.rhq.core.domain.measurement.AvailabilityType; > import org.rhq.core.domain.measurement.MeasurementDataTrait; > import org.rhq.core.domain.measurement.MeasurementReport; > import org.rhq.core.domain.measurement.MeasurementScheduleRequest; >-import org.rhq.core.pluginapi.availability.AvailabilityCollectorRunnable; >-import org.rhq.core.pluginapi.availability.AvailabilityFacet; > import org.rhq.core.pluginapi.event.log.LogFileEventResourceComponentHelper; > import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException; > import org.rhq.core.pluginapi.inventory.ResourceComponent; >@@ -87,7 +85,6 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend > private StartScriptConfiguration startScriptConfig; > private ServerPluginConfiguration serverPluginConfig; > private AvailabilityType previousAvailabilityType; >- private AvailabilityCollectorRunnable availabilityCollector; > private String releaseVersion; > > @Override >@@ -102,23 +99,6 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend > logFileEventDelegate = new LogFileEventResourceComponentHelper(context); > logFileEventDelegate.startLogFileEventPollers(); > startScriptConfig = new StartScriptConfiguration(pluginConfiguration); >- >- Integer availabilityCheckPeriod = null; >- try { >- availabilityCheckPeriod = serverPluginConfig.getAvailabilityCheckPeriod(); >- } catch (NumberFormatException e) { >- log.error("Avail check period config prop was not a valid number. Cause: " + e); >- } >- if (availabilityCheckPeriod != null) { >- long availCheckMillis = availabilityCheckPeriod * 1000L; >- this.availabilityCollector = resourceContext.getAvailabilityContext().createAvailabilityCollectorRunnable( >- new AvailabilityFacet() { >- public AvailabilityType getAvailability() { >- return getAvailabilityNow(); >- } >- }, availCheckMillis); >- this.availabilityCollector.start(); >- } > } > > @Override >@@ -126,29 +106,10 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend > connection.shutdown(); > logFileEventDelegate.stopLogFileEventPollers(); > previousAvailabilityType = null; >- if (this.availabilityCollector != null) { >- this.availabilityCollector.stop(); >- this.availabilityCollector = null; >- } > } > > @Override > public AvailabilityType getAvailability() { >- AvailabilityType ret; >- if (this.availabilityCollector != null) { >- ret = this.availabilityCollector.getLastKnownAvailability(); >- } else { >- ret = getAvailabilityNow(); >- } >- >- if (ret == AvailabilityType.DOWN) { >- releaseVersion = null; >- } >- >- return ret; >- } >- >- private AvailabilityType getAvailabilityNow() { > AvailabilityType availabilityType; > try { > readAttribute("launch-type"); >@@ -166,6 +127,10 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend > previousAvailabilityType = availabilityType; > } > >+ if (availabilityType == AvailabilityType.DOWN) { >+ releaseVersion = null; >+ } >+ > return availabilityType; > } > >diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java >index ac92616..5c02170 100644 >--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java >+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java >@@ -19,8 +19,6 @@ > > package org.rhq.modules.plugins.jbossas7; > >-import static org.rhq.modules.plugins.jbossas7.helper.ServerPluginConfiguration.Property.AVAIL_CHECK_PERIOD_CONFIG_PROP; >- > import java.util.Collections; > import java.util.Date; > import java.util.HashSet; >@@ -33,8 +31,6 @@ import org.rhq.core.domain.measurement.AvailabilityType; > import org.rhq.core.domain.measurement.MeasurementDataTrait; > import org.rhq.core.domain.measurement.MeasurementReport; > import org.rhq.core.domain.measurement.MeasurementScheduleRequest; >-import org.rhq.core.pluginapi.availability.AvailabilityCollectorRunnable; >-import org.rhq.core.pluginapi.availability.AvailabilityFacet; > import org.rhq.core.pluginapi.event.log.LogFileEventResourceComponentHelper; > import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException; > import org.rhq.core.pluginapi.inventory.ResourceContext; >@@ -56,7 +52,6 @@ public class ManagedASComponent extends BaseComponent<HostControllerComponent<?> > private static final String MANAGED_SERVER_TYPE_NAME = "Managed Server"; > > private LogFileEventResourceComponentHelper logFileEventDelegate; >- private AvailabilityCollectorRunnable availabilityCollector; > > @Override > public void start(ResourceContext<HostControllerComponent<?>> hostControllerComponentResourceContext) >@@ -66,33 +61,12 @@ public class ManagedASComponent extends BaseComponent<HostControllerComponent<?> > logFileEventDelegate = new LogFileEventResourceComponentHelper(context); > logFileEventDelegate.startLogFileEventPollers(); > >- Integer availabilityCheckPeriod = null; >- try { >- availabilityCheckPeriod = pluginConfiguration.getSimple(AVAIL_CHECK_PERIOD_CONFIG_PROP).getIntegerValue(); >- } catch (NumberFormatException e) { >- log.error("Avail check period config prop was not a valid number. Cause: " + e); >- } >- if (availabilityCheckPeriod != null) { >- long availCheckMillis = availabilityCheckPeriod * 1000L; >- this.availabilityCollector = hostControllerComponentResourceContext.getAvailabilityContext() >- .createAvailabilityCollectorRunnable(new AvailabilityFacet() { >- public AvailabilityType getAvailability() { >- return getAvailabilityNow(); >- } >- }, availCheckMillis); >- this.availabilityCollector.start(); >- } >- > } > > @Override > public void stop() { > super.stop(); > logFileEventDelegate.stopLogFileEventPollers(); >- if (this.availabilityCollector != null) { >- this.availabilityCollector.stop(); >- this.availabilityCollector = null; >- } > } > > /** >@@ -103,14 +77,6 @@ public class ManagedASComponent extends BaseComponent<HostControllerComponent<?> > */ > @Override > public AvailabilityType getAvailability() { >- if (this.availabilityCollector != null) { >- return this.availabilityCollector.getLastKnownAvailability(); >- } else { >- return getAvailabilityNow(); >- } >- } >- >- private AvailabilityType getAvailabilityNow() { > if (context.getResourceType().getName().equals(MANAGED_SERVER_TYPE_NAME)) { > Address theAddress = new Address(); > String host = pluginConfiguration.getSimpleValue("domainHost", "local"); >diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/helper/ServerPluginConfiguration.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/helper/ServerPluginConfiguration.java >index 3832ed2..4695e61 100644 >--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/helper/ServerPluginConfiguration.java >+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/helper/ServerPluginConfiguration.java >@@ -22,7 +22,6 @@ package org.rhq.modules.plugins.jbossas7.helper; > import java.io.File; > > import org.rhq.core.domain.configuration.Configuration; >-import org.rhq.core.domain.configuration.PropertySimple; > import org.rhq.modules.plugins.jbossas7.JBossProductType; > > /** >@@ -45,7 +44,6 @@ public class ServerPluginConfiguration { > public static final String LOG_DIR = "logDir"; > public static final String PRODUCT_TYPE = "productType"; > public static final String HOST_CONFIG_FILE = "hostConfigFile"; >- public static final String AVAIL_CHECK_PERIOD_CONFIG_PROP = "availabilityCheckPeriod"; > } > > private Configuration pluginConfig; >@@ -146,14 +144,4 @@ public class ServerPluginConfiguration { > hostConfigFile.toString() : null); > } > >- public Integer getAvailabilityCheckPeriod() { >- PropertySimple propertySimple = this.pluginConfig.getSimple(Property.AVAIL_CHECK_PERIOD_CONFIG_PROP); >- return propertySimple == null ? null : propertySimple.getIntegerValue(); >- } >- >- public void setAvailabilityCheckPeriod(Integer availabilityCheckPeriod) { >- this.pluginConfig.setSimpleValue(Property.AVAIL_CHECK_PERIOD_CONFIG_PROP, >- availabilityCheckPeriod == null ? null : availabilityCheckPeriod.toString()); >- } >- > } >diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml >index 4e0bf38..9ef8789 100644 >--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml >+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml >@@ -102,16 +102,6 @@ > </c:group> > '> > >- <!ENTITY availabilityCheckPeriod ' >- <c:simple-property name="availabilityCheckPeriod" >- description="The amount of time, in seconds, that must elapse between availability checks to see if the server is up. If set, the availability checks will be performed asynchronously thus allowing slow-responding servers to avoid being falsely reported as down. Minimum value is 60 seconds." >- units="seconds" required="false" type="integer"> >- <c:constraint> >- <c:integer-constraint minimum="60"/> >- </c:constraint> >- </c:simple-property> >-'> >- > <!ENTITY serverKindMetrics ' > <metric property="_skm:release-codename" dataType="trait" displayName="Server Code Name"/> > <metric property="_skm:release-version" dataType="trait" displayName="Server Version"/> >@@ -952,9 +942,6 @@ > &startScriptPluginConfigGroup; > &logSources; > >- <c:group name="advanced" displayName="Advanced" hiddenByDefault="true"> >- &availabilityCheckPeriod; >- </c:group> > </plugin-configuration> > > <process-scan name="HostController" query="process|basename|match=^java.*,arg|org.jboss.as.host-controller|match=.*"/> >@@ -1272,9 +1259,6 @@ > &startScriptPluginConfigGroup; > &logSources; > >- <c:group name="advanced" displayName="Advanced" hiddenByDefault="true"> >- &availabilityCheckPeriod; >- </c:group> > </plugin-configuration> > > <process-scan name="StandaloneAS" query="process|basename|match=^java.*,arg|org.jboss.as.standalone|match=.*"/> >@@ -1723,9 +1707,6 @@ > <plugin-configuration> > <c:simple-property name="path" readOnly="true"/> > &logSources; >- <c:group name="advanced" displayName="Advanced" hiddenByDefault="true"> >- &availabilityCheckPeriod; >- </c:group> > </plugin-configuration> > > <operation name="start" description="Start this server instance." displayName="Start"> >diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractJBossAS7PluginTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractJBossAS7PluginTest.java >index 8c61c8e..32e83f2 100644 >--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractJBossAS7PluginTest.java >+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractJBossAS7PluginTest.java >@@ -19,8 +19,6 @@ > > package org.rhq.modules.plugins.jbossas7.itest; > >-import static org.rhq.core.domain.measurement.AvailabilityType.UP; >-import static org.testng.Assert.assertEquals; > import static org.testng.Assert.assertNotNull; > > import java.util.Set; >@@ -37,7 +35,6 @@ import org.rhq.core.pc.inventory.InventoryManager; > import org.rhq.core.pc.inventory.ResourceContainer; > import org.rhq.core.plugin.testutil.AbstractAgentPluginTest; > import org.rhq.core.pluginapi.operation.OperationResult; >-import org.rhq.modules.plugins.jbossas7.helper.ServerPluginConfiguration; > import org.rhq.modules.plugins.jbossas7.itest.domain.DomainServerComponentTest; > import org.rhq.modules.plugins.jbossas7.itest.standalone.StandaloneServerComponentTest; > import org.rhq.test.arquillian.AfterDiscovery; >@@ -157,21 +154,6 @@ public abstract class AbstractJBossAS7PluginTest extends AbstractAgentPluginTest > return serverResource; > } > >- protected void testAsynchronousAvailabilityCheck(Resource resource) throws Exception { >- // Activate asynchronous availability checking >- ServerPluginConfiguration serverPluginConfig = new ServerPluginConfiguration(resource.getPluginConfiguration()); >- int availabilityCheckPeriod = 65; >- serverPluginConfig.setAvailabilityCheckPeriod(availabilityCheckPeriod); >- restartResourceComponent(resource); >- >- Thread.sleep((3 * availabilityCheckPeriod * 1000L) / 2); >- assertEquals(getAvailability(resource), UP); >- >- // Deactivate asynchronous availability checking as subsequent tests may rely on immediate availabilty checking >- serverPluginConfig.setAvailabilityCheckPeriod(null); >- restartResourceComponent(resource); >- } >- > private void restartResourceComponent(Resource resource) throws PluginContainerException { > InventoryManager inventoryManager = this.pluginContainer.getInventoryManager(); > inventoryManager.deactivateResource(resource); >diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java >index 269474b..7706e23 100644 >--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java >+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java >@@ -80,12 +80,6 @@ public class DomainServerComponentTest extends AbstractServerComponentTest { > testServerAttributeValidation(); > } > >- @Test(priority = 1002) >- public void testDomainServerAsynchronousAvailabilityCheck() throws Exception { >- testAsynchronousAvailabilityCheck(getServerResource()); >- } >- >- > // ******************************* METRICS ******************************* // > @Test(priority = 1003, enabled = true) > public void testDomainReleaseVersionTrait() throws Exception { >diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/ManagedServerTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/ManagedServerTest.java >index 42bab08..cbc4400 100644 >--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/ManagedServerTest.java >+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/ManagedServerTest.java >@@ -93,11 +93,6 @@ public class ManagedServerTest extends AbstractJBossAS7PluginTest { > assertEquals(avail, AvailabilityType.UP); > } > >- @Test(priority = 1022) >- public void testManagedServerAsynchronousAvailabilityCheck() throws Exception { >- testAsynchronousAvailabilityCheck(getResource()); >- } >- > private Resource getResource() { > > InventoryManager im = pluginContainer.getInventoryManager(); >diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java >index 32f92c7..dd1b0ec 100644 >--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java >+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java >@@ -156,11 +156,6 @@ public class StandaloneServerComponentTest extends AbstractServerComponentTest { > > } > >- @Test(priority = 8) >- public void testStandaloneServerAsynchronousAvailabilityCheck() throws Exception { >- testAsynchronousAvailabilityCheck(getServerResource()); >- } >- > protected String getExpectedStartScriptFileName() { > return (File.separatorChar == '/') ? "standalone.sh" : "standalone.bat"; > } >diff --git a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java >index 4e092af..873caaa 100644 >--- a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java >+++ b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java >@@ -80,8 +80,6 @@ import org.rhq.core.domain.measurement.MeasurementDataTrait; > import org.rhq.core.domain.measurement.MeasurementReport; > import org.rhq.core.domain.measurement.MeasurementScheduleRequest; > import org.rhq.core.domain.resource.CreateResourceStatus; >-import org.rhq.core.pluginapi.availability.AvailabilityCollectorRunnable; >-import org.rhq.core.pluginapi.availability.AvailabilityFacet; > import org.rhq.core.pluginapi.content.ContentContext; > import org.rhq.core.pluginapi.content.ContentFacet; > import org.rhq.core.pluginapi.content.ContentServices; >@@ -141,7 +139,6 @@ public class JBossASServerComponent<T extends ResourceComponent<?>> implements M > public static final String SHUTDOWN_MBEAN_OPERATION_CONFIG_PROP = "shutdownMbeanOperation"; > public static final String SHUTDOWN_METHOD_CONFIG_PROP = "shutdownMethod"; > public static final String JAVA_HOME_PATH_CONFIG_PROP = "javaHomePath"; >- public static final String AVAIL_CHECK_PERIOD_CONFIG_PROP = "availabilityCheckPeriod"; > > public static final String BINDING_ADDRESS_CONFIG_PROP = "bindingAddress"; > >@@ -204,8 +201,6 @@ public class JBossASServerComponent<T extends ResourceComponent<?>> implements M > > private MainDeployer mainDeployer; > >- private AvailabilityCollectorRunnable availCollector; >- > private boolean loggedHijackedJnpUrlError; > > // ResourceComponent Implementation -------------------------------------------- >@@ -263,33 +258,10 @@ public class JBossASServerComponent<T extends ResourceComponent<?>> implements M > this.logFileEventDelegate = new LogFileEventResourceComponentHelper(this.resourceContext); > this.logFileEventDelegate.startLogFileEventPollers(); > >- // prepare to perform async avail checking >- String availCheckPeriodProp = pluginConfig.getSimpleValue(AVAIL_CHECK_PERIOD_CONFIG_PROP, null); >- if (availCheckPeriodProp != null) { >- try { >- long availCheckMillis = Integer.parseInt(availCheckPeriodProp) * 1000L; >- this.availCollector = resourceContext.getAvailabilityContext().createAvailabilityCollectorRunnable( >- new AvailabilityFacet() { >- public AvailabilityType getAvailability() { >- return getAvailabilityNow(); >- } >- }, availCheckMillis); >- this.availCollector.start(); >- } catch (NumberFormatException nfe) { >- log.error("avail check period config prop was not a valid number. Cause: " + nfe); >- this.availCollector = null; >- } >- } >- > return; > } > > public void stop() { >- if (this.availCollector != null) { >- this.availCollector.stop(); >- this.availCollector = null; >- } >- > this.logFileEventDelegate.stopLogFileEventPollers(); > if (this.connection != null) { > try { >@@ -304,14 +276,6 @@ public class JBossASServerComponent<T extends ResourceComponent<?>> implements M > } > > public AvailabilityType getAvailability() { >- if (this.availCollector != null) { >- return this.availCollector.getLastKnownAvailability(); >- } else { >- return getAvailabilityNow(); >- } >- } >- >- private AvailabilityType getAvailabilityNow() { > try { > File serverHomeViaJnp = getServerHome(); > if (this.configPath.getCanonicalPath().equals(serverHomeViaJnp.getCanonicalPath())) { >diff --git a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml >index 36bc9fb..90776d1 100644 >--- a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml >+++ b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml >@@ -158,12 +158,6 @@ > description="Name of the operation to invoke when shutting down this server through JMX. > Note that only operations with no parameter or with one int parameter are supported. If the > operation requires an int parameter, '0' will be supplied."/> >- <c:simple-property name="availabilityCheckPeriod" description="The amount of time, in seconds, that must elapse between availability checks to see if the server is up. If set, the availability checks will be performed asynchronously thus allowing slow-responding servers to avoid being falsely reported as down." >- units="seconds" required="false" type="integer"> >- <c:constraint> >- <c:integer-constraint minimum="60"/> >- </c:constraint> >- </c:simple-property> > > <c:simple-property name="childJmxServerName" displayName="JBoss AS JVM Name" default="JVM" > readOnly="true" required="false" >diff --git a/modules/plugins/mysql/src/test/java/org/rhq/plugins/mysql/ComponentTest.java b/modules/plugins/mysql/src/test/java/org/rhq/plugins/mysql/ComponentTest.java >index 610cb61..3b431d6 100644 >--- a/modules/plugins/mysql/src/test/java/org/rhq/plugins/mysql/ComponentTest.java >+++ b/modules/plugins/mysql/src/test/java/org/rhq/plugins/mysql/ComponentTest.java >@@ -38,13 +38,16 @@ import java.util.LinkedHashMap; > import java.util.List; > import java.util.Map; > import java.util.Set; >-import java.util.concurrent.Executor; >-import java.util.concurrent.Executors; > > import javax.xml.bind.JAXBElement; > > import org.apache.commons.logging.Log; > import org.apache.commons.logging.LogFactory; >+import org.testng.annotations.AfterSuite; >+import org.testng.annotations.AfterTest; >+import org.testng.annotations.BeforeClass; >+import org.testng.annotations.BeforeSuite; >+ > import org.rhq.core.clientapi.agent.metadata.PluginMetadataManager; > import org.rhq.core.clientapi.descriptor.AgentPluginDescriptorUtil; > import org.rhq.core.clientapi.descriptor.configuration.ConfigurationProperty; >@@ -92,10 +95,6 @@ import org.rhq.core.system.ProcessInfo; > import org.rhq.core.system.SystemInfo; > import org.rhq.core.system.SystemInfoFactory; > import org.rhq.core.system.pquery.ProcessInfoQuery; >-import org.testng.annotations.AfterSuite; >-import org.testng.annotations.AfterTest; >-import org.testng.annotations.BeforeClass; >-import org.testng.annotations.BeforeSuite; > > /** > * Base class for RHQ Component Testing. >@@ -155,7 +154,6 @@ public abstract class ComponentTest { > private final String pluginContainerName = "rhq"; > private final OperationContext operationContext = new OperationContextImpl(0); > private final ContentContext contentContext = new ContentContextImpl(0); >- private final Executor availCollectorThreadPool = Executors.newCachedThreadPool(); > private PluginContainerDeployment pluginContainerDeployment = null; > private Resource platform; > private ResourceContainer platformContainer; >@@ -295,7 +293,7 @@ public abstract class ComponentTest { > String rclassname = pmm.getComponentClass(type); > ResourceComponent component = (ResourceComponent) Class.forName(rclassname).newInstance(); > >- AvailabilityContext availContext = new AvailabilityContextImpl(cresource,availCollectorThreadPool); >+ AvailabilityContext availContext = new AvailabilityContextImpl(cresource); > InventoryContext inventoryContext = new InventoryContextImpl(cresource); > > EventContext eventContext = new EventContextImpl(resource); >diff --git a/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java b/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java >index 569bd09..e98c2e9 100644 >--- a/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java >+++ b/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java >@@ -10,7 +10,6 @@ import java.util.HashSet; > import java.util.LinkedHashMap; > import java.util.Map; > import java.util.Set; >-import java.util.concurrent.Executors; > > import org.apache.commons.logging.Log; > import org.apache.commons.logging.LogFactory; >@@ -134,7 +133,7 @@ public abstract class ComponentTest { > > ResourceDiscoveryComponent resourceDiscoveryComponent = new NothingDiscoveringDiscoveryComponent(); > EventContext eventContext = new EventContextImpl(resource); >- AvailabilityContext availContext = new AvailabilityContextImpl(resource, Executors.newCachedThreadPool()); >+ AvailabilityContext availContext = new AvailabilityContextImpl(resource); > InventoryContext inventoryContext = new InventoryContextImpl(resource); > ResourceContext context = new ResourceContext(resource, parentResourceComponent, parentResourceContext, > resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory, pluginContainerName, >@@ -172,7 +171,7 @@ public abstract class ComponentTest { > log.debug("rdc=" + rdc); > > EventContext eventContext = new EventContextImpl(resource); >- AvailabilityContext availContext = new AvailabilityContextImpl(resource, Executors.newCachedThreadPool()); >+ AvailabilityContext availContext = new AvailabilityContextImpl(resource); > InventoryContext inventoryContext = new InventoryContextImpl(resource); > ResourceContext context = new ResourceContext(resource, component, parentContext, resourceDiscoveryComponent, > systemInfo, temporaryDirectory, dataDirectory, pluginContainerName, eventContext, operationContext, >@@ -204,7 +203,7 @@ public abstract class ComponentTest { > ResourceComponent component = (ResourceComponent) Class.forName(rclassname).newInstance(); > > EventContext eventContext = new EventContextImpl(resource); >- AvailabilityContext availContext = new AvailabilityContextImpl(resource, Executors.newCachedThreadPool()); >+ AvailabilityContext availContext = new AvailabilityContextImpl(resource); > InventoryContext inventoryContext = new InventoryContextImpl(resource); > ResourceContext context = new ResourceContext(cresource, parentComponent, parentContext, > resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory, pluginContainerName, >diff --git a/modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java b/modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java >index cd90737..24b6d9f 100644 >--- a/modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java >+++ b/modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java >@@ -4,7 +4,6 @@ import java.io.File; > import java.io.InputStream; > import java.util.Set; > import java.util.UUID; >-import java.util.concurrent.Executors; > > import org.apache.commons.logging.Log; > import org.apache.commons.logging.LogFactory; >@@ -98,7 +97,7 @@ public abstract class ComponentTest { > OperationContext operationContext = new OperationContextImpl(0); > ContentContext contentContext = new ContentContextImpl(0); > PluginContainerDeployment pluginContainerDeployment = null; >- AvailabilityContext availContext = new AvailabilityContextImpl(resource, Executors.newCachedThreadPool()); >+ AvailabilityContext availContext = new AvailabilityContextImpl(resource); > InventoryContext inventoryContext = new InventoryContextImpl(resource); > ResourceContext context = new ResourceContext(resource, parentResourceComponent, parentResourceContext, > resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory, pluginContainerName,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1037855
:
832687
| 832706