INT-3799: Fix Tangles

Part 1 - eliminate references from support to other packages

Part 2 - handler to aggregator/router
- move BarrierMH to aggregator
- Fix ScatterGather references

Part 3 - move TrackableComponent
- to support.management

Part 4 - class tangles
- TcpConnectionServerExceptionEvent
- RecipientListRouterManagement

INT-3799: Polishing
This commit is contained in:
Gary Russell
2015-08-12 13:23:05 -04:00
committed by Artem Bilan
parent 9ff5ab789a
commit 4ab25121af
51 changed files with 79 additions and 136 deletions

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.handler;
package org.springframework.integration.aggregator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -22,10 +22,8 @@ import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.TimeUnit;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.aggregator.CorrelationStrategy;
import org.springframework.integration.aggregator.DefaultAggregatingMessageGroupProcessor;
import org.springframework.integration.aggregator.HeaderAttributeCorrelationStrategy;
import org.springframework.integration.aggregator.MessageGroupProcessor;
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
import org.springframework.integration.handler.MessageTriggerAction;
import org.springframework.integration.store.SimpleMessageGroup;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandlingException;

View File

@@ -28,18 +28,18 @@ import org.apache.commons.logging.Log;
import org.springframework.core.OrderComparator;
import org.springframework.core.convert.ConversionService;
import org.springframework.integration.channel.management.AbstractMessageChannelMetrics;
import org.springframework.integration.channel.management.DefaultMessageChannelMetrics;
import org.springframework.integration.channel.management.MessageChannelMetrics;
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.context.IntegrationObjectSupport;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.history.TrackableComponent;
import org.springframework.integration.support.converter.DefaultDatatypeChannelMessageConverter;
import org.springframework.integration.support.management.AbstractMessageChannelMetrics;
import org.springframework.integration.support.management.ConfigurableMetricsAware;
import org.springframework.integration.support.management.DefaultMessageChannelMetrics;
import org.springframework.integration.support.management.IntegrationManagedResource;
import org.springframework.integration.support.management.MessageChannelMetrics;
import org.springframework.integration.support.management.MetricsContext;
import org.springframework.integration.support.management.Statistics;
import org.springframework.integration.support.management.TrackableComponent;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageDeliveryException;

View File

@@ -20,7 +20,7 @@ import java.util.ArrayDeque;
import java.util.Deque;
import java.util.List;
import org.springframework.integration.channel.management.PollableChannelManagement;
import org.springframework.integration.support.management.PollableChannelManagement;
import org.springframework.messaging.Message;
import org.springframework.messaging.PollableChannel;
import org.springframework.messaging.support.ChannelInterceptor;

View File

@@ -20,12 +20,12 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.integration.channel.management.AbstractMessageChannelMetrics;
import org.springframework.integration.channel.management.DefaultMessageChannelMetrics;
import org.springframework.integration.channel.management.MessageChannelMetrics;
import org.springframework.integration.support.context.NamedComponent;
import org.springframework.integration.support.management.AbstractMessageChannelMetrics;
import org.springframework.integration.support.management.ConfigurableMetricsAware;
import org.springframework.integration.support.management.DefaultMessageChannelMetrics;
import org.springframework.integration.support.management.IntegrationManagedResource;
import org.springframework.integration.support.management.MessageChannelMetrics;
import org.springframework.integration.support.management.Statistics;
import org.springframework.messaging.Message;
import org.springframework.messaging.PollableChannel;

View File

@@ -24,8 +24,8 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import org.springframework.integration.channel.management.QueueChannelManagement;
import org.springframework.integration.core.MessageSelector;
import org.springframework.integration.support.management.QueueChannelManagement;
import org.springframework.messaging.Message;
import org.springframework.util.Assert;

View File

@@ -1,4 +0,0 @@
/**
* Provides classes related to channel management.
*/
package org.springframework.integration.channel.management;

View File

@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.support.converter;
package org.springframework.integration.codec;
import java.io.IOException;
import org.springframework.integration.codec.Codec;
import org.springframework.integration.context.IntegrationObjectSupport;
import org.springframework.integration.support.AbstractIntegrationMessageBuilder;
import org.springframework.messaging.Message;

View File

@@ -32,9 +32,9 @@ import org.springframework.integration.aggregator.CorrelationStrategy;
import org.springframework.integration.aggregator.MessageGroupProcessor;
import org.springframework.integration.aggregator.MethodInvokingMessageGroupProcessor;
import org.springframework.integration.aggregator.ReleaseStrategy;
import org.springframework.integration.handler.management.AbstractMessageHandlerMetrics;
import org.springframework.integration.store.MessageGroupStore;
import org.springframework.integration.support.locks.LockRegistry;
import org.springframework.integration.support.management.AbstractMessageHandlerMetrics;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.core.DestinationResolver;
import org.springframework.scheduling.TaskScheduler;

View File

@@ -20,7 +20,7 @@ import org.w3c.dom.Element;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.handler.BarrierMessageHandler;
import org.springframework.integration.aggregator.BarrierMessageHandler;
import org.springframework.util.StringUtils;
/**

View File

@@ -19,7 +19,7 @@ package org.springframework.integration.endpoint;
import org.springframework.integration.core.MessageProducer;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.history.TrackableComponent;
import org.springframework.integration.support.management.TrackableComponent;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessagingException;

View File

@@ -29,8 +29,8 @@ import org.springframework.integration.aop.AbstractMessageSourceAdvice;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.history.TrackableComponent;
import org.springframework.integration.support.context.NamedComponent;
import org.springframework.integration.support.management.TrackableComponent;
import org.springframework.integration.transaction.IntegrationResourceHolder;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;

View File

@@ -48,8 +48,8 @@ import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.integration.annotation.Gateway;
import org.springframework.integration.annotation.GatewayHeader;
import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.integration.history.TrackableComponent;
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
import org.springframework.integration.support.management.TrackableComponent;
import org.springframework.integration.support.utils.IntegrationUtils;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;

View File

@@ -23,12 +23,12 @@ import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.endpoint.PollingConsumer;
import org.springframework.integration.handler.BridgeHandler;
import org.springframework.integration.history.HistoryWritingMessagePostProcessor;
import org.springframework.integration.history.TrackableComponent;
import org.springframework.integration.mapping.InboundMessageMapper;
import org.springframework.integration.mapping.OutboundMessageMapper;
import org.springframework.integration.support.DefaultMessageBuilderFactory;
import org.springframework.integration.support.MessageBuilderFactory;
import org.springframework.integration.support.converter.SimpleMessageConverter;
import org.springframework.integration.support.management.TrackableComponent;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessagingException;

View File

@@ -19,15 +19,15 @@ package org.springframework.integration.handler;
import org.springframework.core.Ordered;
import org.springframework.integration.context.IntegrationObjectSupport;
import org.springframework.integration.context.Orderable;
import org.springframework.integration.handler.management.AbstractMessageHandlerMetrics;
import org.springframework.integration.handler.management.DefaultMessageHandlerMetrics;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.history.TrackableComponent;
import org.springframework.integration.support.management.AbstractMessageHandlerMetrics;
import org.springframework.integration.support.management.ConfigurableMetricsAware;
import org.springframework.integration.support.management.DefaultMessageHandlerMetrics;
import org.springframework.integration.support.management.IntegrationManagedResource;
import org.springframework.integration.support.management.MessageHandlerMetrics;
import org.springframework.integration.support.management.MetricsContext;
import org.springframework.integration.support.management.Statistics;
import org.springframework.integration.support.management.TrackableComponent;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessageHandlingException;

View File

@@ -1,4 +0,0 @@
/**
* Provides classes related to handler management.
*/
package org.springframework.integration.handler.management;

View File

@@ -18,6 +18,7 @@ package org.springframework.integration.history;
import org.springframework.integration.support.DefaultMessageBuilderFactory;
import org.springframework.integration.support.MessageBuilderFactory;
import org.springframework.integration.support.management.TrackableComponent;
import org.springframework.messaging.Message;
import org.springframework.messaging.core.MessagePostProcessor;
import org.springframework.util.Assert;

View File

@@ -32,6 +32,7 @@ import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionValidationException;
import org.springframework.context.SmartLifecycle;
import org.springframework.integration.support.management.IntegrationManagedResource;
import org.springframework.integration.support.management.TrackableComponent;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;

View File

@@ -19,7 +19,6 @@ import java.util.Collection;
import java.util.Map;
import java.util.Properties;
import org.springframework.integration.router.RecipientListRouter.Recipient;
import org.springframework.integration.support.management.IntegrationManagedResource;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedOperation;
@@ -74,7 +73,7 @@ public interface RecipientListRouterManagement {
* @return an unmodifiable collection of recipients.
*/
@ManagedAttribute
Collection<Recipient> getRecipients();
Collection<?> getRecipients();
/**
* Replace recipient.

View File

@@ -18,7 +18,6 @@ package org.springframework.integration.scattergather;
import org.springframework.aop.support.AopUtils;
import org.springframework.context.Lifecycle;
import org.springframework.integration.aggregator.AggregatingMessageHandler;
import org.springframework.integration.channel.FixedSubscriberChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.context.IntegrationContextUtils;
@@ -27,7 +26,6 @@ import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.endpoint.PollingConsumer;
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
import org.springframework.integration.router.RecipientListRouter;
import org.springframework.integration.support.channel.HeaderChannelRegistry;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
@@ -38,6 +36,7 @@ import org.springframework.messaging.MessagingException;
import org.springframework.messaging.PollableChannel;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
/**
* The {@link MessageHandler} implementation for the
@@ -67,8 +66,7 @@ public class ScatterGatherHandler extends AbstractReplyProducingMessageHandler i
Assert.notNull(scatterChannel);
Assert.notNull(gatherer);
Class<?> gathererClass = AopUtils.getTargetClass(gatherer);
Assert.isAssignable(AggregatingMessageHandler.class, gathererClass,
"the 'gatherer' must be an AggregatingMessageHandler instance");
checkClass(gathererClass, "org.springframework.integration.aggregator.AggregatingMessageHandler", "gatherer");
this.scatterChannel = scatterChannel;
this.gatherer = gatherer;
}
@@ -76,9 +74,8 @@ public class ScatterGatherHandler extends AbstractReplyProducingMessageHandler i
public ScatterGatherHandler(MessageHandler scatterer, MessageHandler gatherer) {
this(new FixedSubscriberChannel(scatterer), gatherer);
Assert.notNull(scatterer);
Class<?> scatterClass = AopUtils.getTargetClass(scatterer);
Assert.isAssignable(RecipientListRouter.class, scatterClass,
"the 'scatterer' must be a RecipientListRouter instance");
Class<?> scattererClass = AopUtils.getTargetClass(scatterer);
checkClass(scattererClass, "org.springframework.integration.router.RecipientListRouter", "scatterer");
}
public void setGatherChannel(MessageChannel gatherChannel) {
@@ -178,4 +175,14 @@ public class ScatterGatherHandler extends AbstractReplyProducingMessageHandler i
return this.gatherEndpoint == null || this.gatherEndpoint.isRunning();
}
private void checkClass(Class<?> gathererClass, String className, String type) throws LinkageError {
Class<?> clazz = null;
try {
clazz = ClassUtils.forName(className, getClass().getClassLoader());
}
catch (Exception e) {
}
Assert.isAssignable(clazz, gathererClass, "the '" + type + "' must be an " + className + " instance");
}
}

View File

@@ -13,15 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.channel.management;
package org.springframework.integration.support.management;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.integration.support.management.ConfigurableMetrics;
import org.springframework.integration.support.management.MetricsContext;
import org.springframework.integration.support.management.Statistics;
/**
* Abstract base class for channel metrics implementations.
*

View File

@@ -13,15 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.handler.management;
package org.springframework.integration.support.management;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.integration.support.management.ConfigurableMetrics;
import org.springframework.integration.support.management.MetricsContext;
import org.springframework.integration.support.management.Statistics;
/**
* Abstract base class for handler metrics implementations.
*

View File

@@ -11,12 +11,8 @@
* specific language governing permissions and limitations under the License.
*/
package org.springframework.integration.channel.management;
package org.springframework.integration.support.management;
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.MetricsContext;
/**
* An implementation of {@link MessageChannelMetrics} that aggregates the total response

View File

@@ -14,10 +14,8 @@
* limitations under the License.
*/
package org.springframework.integration.handler.management;
package org.springframework.integration.support.management;
import org.springframework.integration.support.management.ExponentialMovingAverage;
import org.springframework.integration.support.management.MetricsContext;
/**
* An implementation of {@link org.springframework.integration.support.management.MessageHandlerMetrics}

View File

@@ -15,10 +15,6 @@
*/
package org.springframework.integration.support.management;
import org.springframework.integration.channel.management.AbstractMessageChannelMetrics;
import org.springframework.integration.channel.management.AggregatingMessageChannelMetrics;
import org.springframework.integration.handler.management.AbstractMessageHandlerMetrics;
import org.springframework.integration.handler.management.AggregatingMessageHandlerMetrics;

View File

@@ -11,16 +11,10 @@
* specific language governing permissions and limitations under the License.
*/
package org.springframework.integration.channel.management;
package org.springframework.integration.support.management;
import java.util.concurrent.atomic.AtomicLong;
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.MetricsContext;
import org.springframework.integration.support.management.Statistics;
/**
* Default implementation; use the full constructor to customize the moving averages.
*

View File

@@ -14,14 +14,10 @@
* limitations under the License.
*/
package org.springframework.integration.handler.management;
package org.springframework.integration.support.management;
import java.util.concurrent.atomic.AtomicLong;
import org.springframework.integration.support.management.ExponentialMovingAverage;
import org.springframework.integration.support.management.MetricsContext;
import org.springframework.integration.support.management.Statistics;
/**
* Default implementation; use the full constructor to customize the moving averages.
*

View File

@@ -15,10 +15,6 @@
*/
package org.springframework.integration.support.management;
import org.springframework.integration.channel.management.AbstractMessageChannelMetrics;
import org.springframework.integration.channel.management.DefaultMessageChannelMetrics;
import org.springframework.integration.handler.management.AbstractMessageHandlerMetrics;
import org.springframework.integration.handler.management.DefaultMessageHandlerMetrics;

View File

@@ -24,9 +24,6 @@ import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.integration.channel.management.AbstractMessageChannelMetrics;
import org.springframework.integration.channel.management.MessageChannelMetrics;
import org.springframework.integration.handler.management.AbstractMessageHandlerMetrics;
import org.springframework.util.Assert;
import org.springframework.util.PatternMatchUtils;

View File

@@ -17,7 +17,6 @@
package org.springframework.integration.support.management;
import org.springframework.context.Lifecycle;
import org.springframework.integration.handler.management.AbstractMessageHandlerMetrics;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedOperation;

View File

@@ -17,7 +17,6 @@
package org.springframework.integration.support.management;
import org.springframework.context.Lifecycle;
import org.springframework.integration.history.TrackableComponent;
import org.springframework.util.Assert;
/**

View File

@@ -17,7 +17,6 @@
package org.springframework.integration.support.management;
import org.springframework.context.Lifecycle;
import org.springframework.integration.history.TrackableComponent;
import org.springframework.util.Assert;
/**

View File

@@ -14,10 +14,8 @@
* limitations under the License.
*/
package org.springframework.integration.channel.management;
package org.springframework.integration.support.management;
import org.springframework.integration.support.management.IntegrationStatsManagement;
import org.springframework.integration.support.management.Statistics;
import org.springframework.jmx.export.annotation.ManagedMetric;
import org.springframework.jmx.support.MetricType;

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.integration.support.management;
import org.springframework.integration.channel.management.AbstractMessageChannelMetrics;
import org.springframework.integration.handler.management.AbstractMessageHandlerMetrics;
/**
* Factories implementing this interface provide metric objects for message channels and

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.channel.management;
package org.springframework.integration.support.management;
import org.springframework.jmx.export.annotation.ManagedMetric;
import org.springframework.jmx.support.MetricType;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.channel.management;
package org.springframework.integration.support.management;
import org.springframework.jmx.export.annotation.ManagedMetric;
import org.springframework.jmx.support.MetricType;

View File

@@ -14,10 +14,9 @@
* limitations under the License.
*/
package org.springframework.integration.history;
package org.springframework.integration.support.management;
import org.springframework.integration.support.context.NamedComponent;
import org.springframework.integration.support.management.IntegrationManagedResource;
import org.springframework.jmx.export.annotation.ManagedOperation;
/**

View File

@@ -17,7 +17,6 @@
package org.springframework.integration.support.management;
import org.springframework.context.Lifecycle;
import org.springframework.integration.history.TrackableComponent;
import org.springframework.util.Assert;
/**

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.handler;
package org.springframework.integration.aggregator;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals;
@@ -46,6 +46,7 @@ import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.aggregator.BarrierMessageHandler;
import org.springframework.integration.annotation.Poller;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.channel.DirectChannel;

View File

@@ -25,12 +25,12 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.aggregator.BarrierMessageHandler;
import org.springframework.integration.aggregator.CorrelationStrategy;
import org.springframework.integration.aggregator.HeaderAttributeCorrelationStrategy;
import org.springframework.integration.aggregator.MessageGroupProcessor;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.integration.endpoint.PollingConsumer;
import org.springframework.integration.handler.BarrierMessageHandler;
import org.springframework.integration.store.MessageGroup;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.messaging.Message;