INT-4390: Fix tangles

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

Phase I: flow context/registration cycle

- extract interfaces
- rename implementations to `Standard...`

Phase II - dsl<->dsl.channel tangles

Move the channel specs to dsl.

Fix missing refactorings

(Not related to DSL) - rename core `event` package to `events`

- avoid collision with event module package
- fix tangle caused by `MessageGroupExpiredEvent`.

Phase III - dsl<->config.dsl

- move classes from config.dsl to dsl

(Not related to DSL) - fix many tangles caused by graph being a sub-package of support.management
 - make `graph` a top-level package

(Not related to DSL) - move `IntegrationManagementConfigurer` from
`management` to `config` - tangle between core and management
* Polishing Copyrights, diamonds, some JavaDocs and What's New
This commit is contained in:
Gary Russell
2018-03-14 12:10:33 -04:00
committed by Artem Bilan
parent 7f25cba262
commit 82f252dd00
93 changed files with 968 additions and 694 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,9 +42,8 @@ import org.springframework.context.expression.StandardBeanExpressionResolver;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.integration.config.IntegrationManagementConfigurer;
import org.springframework.integration.monitor.IntegrationMBeanExporter;
import org.springframework.integration.support.management.IntegrationManagementConfigurer;
import org.springframework.jmx.support.RegistrationPolicy;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -56,6 +55,7 @@ import org.springframework.util.StringUtils;
*
* @author Artem Bilan
* @author Gary Russell
*
* @since 4.0
*/
@Configuration
@@ -103,7 +103,7 @@ public class IntegrationMBeanExportConfiguration implements ImportAware, Environ
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public IntegrationMBeanExporter mbeanExporter() {
IntegrationMBeanExporter exporter = new IntegrationMBeanExporter();
exporter.setRegistrationPolicy(this.attributes.<RegistrationPolicy>getEnum("registration"));
exporter.setRegistrationPolicy(this.attributes.getEnum("registration"));
setupDomain(exporter);
setupServer(exporter);
setupComponentNamePatterns(exporter);
@@ -152,7 +152,7 @@ public class IntegrationMBeanExportConfiguration implements ImportAware, Environ
}
private void setupComponentNamePatterns(IntegrationMBeanExporter exporter) {
List<String> patterns = new ArrayList<String>();
List<String> patterns = new ArrayList<>();
String[] managedComponents = this.attributes.getStringArray("managedComponents");
for (String managedComponent : managedComponents) {
String pattern = this.environment.resolvePlaceholders(managedComponent);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,6 +44,7 @@ import org.springframework.context.ApplicationContextAware;
import org.springframework.context.EmbeddedValueResolverAware;
import org.springframework.context.Lifecycle;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.config.IntegrationManagementConfigurer;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.context.OrderlyShutdownCapable;
import org.springframework.integration.core.MessageProducer;
@@ -52,7 +53,6 @@ import org.springframework.integration.gateway.MessagingGatewaySupport;
import org.springframework.integration.handler.AbstractMessageProducingHandler;
import org.springframework.integration.history.MessageHistoryConfigurer;
import org.springframework.integration.support.context.NamedComponent;
import org.springframework.integration.support.management.IntegrationManagementConfigurer;
import org.springframework.integration.support.management.LifecycleMessageHandlerMetrics;
import org.springframework.integration.support.management.LifecycleMessageSourceManagement;
import org.springframework.integration.support.management.LifecycleMessageSourceMetrics;
@@ -123,31 +123,32 @@ public class IntegrationMBeanExporter extends MBeanExporter implements Applicati
private ApplicationContext applicationContext;
private final Map<Object, AtomicLong> anonymousHandlerCounters = new HashMap<Object, AtomicLong>();
private final Map<Object, AtomicLong> anonymousHandlerCounters = new HashMap<>();
private final Map<Object, AtomicLong> anonymousSourceCounters = new HashMap<Object, AtomicLong>();
private final Map<Object, AtomicLong> anonymousSourceCounters = new HashMap<>();
private final Set<MessageHandlerMetrics> handlers = new HashSet<MessageHandlerMetrics>();
private final Set<MessageHandlerMetrics> handlers = new HashSet<>();
private final Set<MessageSourceMetrics> sources = new HashSet<MessageSourceMetrics>();
private final Set<MessageSourceMetrics> sources = new HashSet<>();
private final Set<Lifecycle> inboundLifecycleMessageProducers = new HashSet<Lifecycle>();
private final Set<Lifecycle> inboundLifecycleMessageProducers = new HashSet<>();
private final Set<MessageChannelMetrics> channels = new HashSet<MessageChannelMetrics>();
private final Set<MessageChannelMetrics> channels = new HashSet<>();
private final Map<String, MessageChannelMetrics> allChannelsByName = new HashMap<String, MessageChannelMetrics>();
private final Map<String, MessageChannelMetrics> allChannelsByName = new HashMap<>();
private final Map<String, MessageHandlerMetrics> allHandlersByName = new HashMap<String, MessageHandlerMetrics>();
private final Map<String, MessageHandlerMetrics> allHandlersByName = new HashMap<>();
private final Map<String, MessageSourceMetrics> allSourcesByName = new HashMap<String, MessageSourceMetrics>();
private final Map<String, MessageSourceMetrics> allSourcesByName = new HashMap<>();
private final Map<String, String> beansByEndpointName = new HashMap<String, String>();
private final Map<String, String> beansByEndpointName = new HashMap<>();
private String domain = DEFAULT_DOMAIN;
private final Properties objectNameStaticProperties = new Properties();
private final MetadataNamingStrategy defaultNamingStrategy = new IntegrationMetadataNamingStrategy(this.attributeSource);
private final MetadataNamingStrategy defaultNamingStrategy =
new IntegrationMetadataNamingStrategy(this.attributeSource);
private String[] componentNamePatterns = { "*" };
@@ -300,7 +301,7 @@ public class IntegrationMBeanExporter extends MBeanExporter implements Applicati
private MessageHandler handlerInAnonymousWrapper(final Object bean) {
if (bean != null && bean.getClass().isAnonymousClass()) {
final AtomicReference<MessageHandler> wrapped = new AtomicReference<MessageHandler>();
final AtomicReference<MessageHandler> wrapped = new AtomicReference<>();
ReflectionUtils.doWithFields(bean.getClass(), field -> {
field.setAccessible(true);
Object handler = field.get(bean);
@@ -320,7 +321,7 @@ public class IntegrationMBeanExporter extends MBeanExporter implements Applicati
* and risk it being a proxy (which it almost certainly is by now).
*
* @param bean the bean instance to register
* @param beanKey the bean name or human readable version if autogenerated
* @param beanKey the bean name or human readable version if auto-generated
* @return the JMX object name of the MBean that was registered
*/
private ObjectName registerBeanInstance(Object bean, String beanKey) {
@@ -678,7 +679,7 @@ public class IntegrationMBeanExporter extends MBeanExporter implements Applicati
private void registerEndpoints() {
String[] names = this.applicationContext.getBeanNamesForType(AbstractEndpoint.class);
Set<String> endpointNames = new HashSet<String>();
Set<String> endpointNames = new HashSet<>();
for (String name : names) {
if (!this.beansByEndpointName.values().contains(name)) {
AbstractEndpoint endpoint = this.applicationContext.getBean(name, AbstractEndpoint.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.integration.config.IntegrationManagementConfigurer;
import org.springframework.integration.monitor.IntegrationMBeanExporter;
import org.springframework.integration.support.management.AbstractMessageChannelMetrics;
import org.springframework.integration.support.management.AbstractMessageHandlerMetrics;
@@ -39,7 +40,6 @@ import org.springframework.integration.support.management.DefaultMessageHandlerM
import org.springframework.integration.support.management.ExponentialMovingAverage;
import org.springframework.integration.support.management.ExponentialMovingAverageRate;
import org.springframework.integration.support.management.ExponentialMovingAverageRatio;
import org.springframework.integration.support.management.IntegrationManagementConfigurer;
import org.springframework.integration.support.management.MessageChannelMetrics;
import org.springframework.integration.support.management.MessageHandlerMetrics;
import org.springframework.integration.support.management.MetricsFactory;
@@ -53,6 +53,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* @author Oleg Zhurakousky
* @author Gunnar Hillert
* @author Gary Russell
*
* @since 2.0
*/
@ContextConfiguration
@@ -64,7 +65,7 @@ public class MBeanExporterParserTests {
private ApplicationContext context;
@Test
public void testMBeanExporterExists() throws InterruptedException {
public void testMBeanExporterExists() {
IntegrationMBeanExporter exporter = this.context.getBean(IntegrationMBeanExporter.class);
MBeanServer server = this.context.getBean("mbs", MBeanServer.class);
Properties properties = TestUtils.getPropertyValue(exporter, "objectNameStaticProperties", Properties.class);

View File

@@ -43,10 +43,10 @@ import org.springframework.context.support.GenericApplicationContext;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.config.EnableIntegration;
import org.springframework.integration.config.EnableIntegrationManagement;
import org.springframework.integration.config.IntegrationManagementConfigurer;
import org.springframework.integration.jmx.config.EnableIntegrationMBeanExport;
import org.springframework.integration.monitor.IntegrationMBeanExporter;
import org.springframework.integration.support.management.DefaultMetricsFactory;
import org.springframework.integration.support.management.IntegrationManagementConfigurer;
import org.springframework.integration.support.management.MetricsFactory;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.jmx.support.MBeanServerFactoryBean;