INT-2541: Fix @ManagedResource JMX registration

JIRA: https://jira.spring.io/browse/INT-2541

The `IntegrationMBeanExporter` doesn't register any `@ManagedResource` automatically.
Its `autoDetection` is disabled by default.
Hence such a components like `AbstractMessageGroupStore`
or `WireTap` aren't exposed to the JMX by the `IntegrationMBeanExporter`.
From other side `MBeanExporterHelper` aims to help to avoid duplicate exposing if
an `MBeanExporter` is presented in the CTX.
But `MBeanExporterHelper` did that unconditionally just for the whole `org.springframework.integration` package.
Therefore components which aren't EIP ones aren't exposed to the JMX at all.

* Fix `MBeanExporterHelper` to deal for exclusion based on the `@IntegrationManagedResource` annotation.
* Remove `@IntegrationManagedResource` from those components which aren't EIP.
* Make some polishing in the JMX tests.
This commit is contained in:
Artem Bilan
2015-10-12 15:34:32 -04:00
committed by Gary Russell
parent f049541b00
commit ccc1568b89
11 changed files with 69 additions and 94 deletions

View File

@@ -22,7 +22,6 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.context.Lifecycle;
import org.springframework.integration.channel.ChannelInterceptorAware;
import org.springframework.integration.core.MessageSelector;
import org.springframework.integration.support.management.IntegrationManagedResource;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;
@@ -40,7 +39,6 @@ import org.springframework.util.Assert;
* @author Gary Russell
*/
@ManagedResource
@IntegrationManagedResource
public class WireTap extends ChannelInterceptorAdapter implements Lifecycle, VetoCapableInterceptor {
private static final Log logger = LogFactory.getLog(WireTap.class);

View File

@@ -16,7 +16,6 @@
package org.springframework.integration.metadata;
import org.springframework.integration.support.management.IntegrationManagedResource;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedResource;
@@ -31,7 +30,6 @@ import org.springframework.jmx.export.annotation.ManagedResource;
* @since 2.0
*/
@ManagedResource
@IntegrationManagedResource
public interface MetadataStore {
/**

View File

@@ -24,7 +24,6 @@ import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.integration.support.DefaultMessageBuilderFactory;
import org.springframework.integration.support.MessageBuilderFactory;
import org.springframework.integration.support.management.IntegrationManagedResource;
import org.springframework.integration.support.utils.IntegrationUtils;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedResource;
@@ -39,7 +38,6 @@ import org.springframework.messaging.Message;
* @since 2.0
*/
@ManagedResource
@IntegrationManagedResource
public abstract class AbstractMessageGroupStore extends AbstractBatchingMessageGroupStore
implements MessageGroupStore, Iterable<MessageGroup>, BeanFactoryAware {