INT-1257, INT-1263 Refactoring Message History (work in progress): removed MessageHistory and MessageHistoryEvent, moved MessageHistoryWriter and NamedComponent to the 'context' package.
This commit is contained in:
@@ -37,6 +37,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.config.ConsumerEndpointFactoryBean;
|
||||
import org.springframework.integration.context.MessageHistoryWriter;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2010 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.history;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class MessageHistoryTests {
|
||||
|
||||
private long times = 1000;
|
||||
|
||||
private ExecutorService executor = Executors.newCachedThreadPool();
|
||||
|
||||
@Test
|
||||
public void testConcurrentModificationsOnObjectMethods() throws Exception{
|
||||
final MessageHistory history = new MessageHistory();
|
||||
final MessageHistory otherHistory = new MessageHistory();
|
||||
final NamedComponent component = new NamedComponent() {
|
||||
public String getComponentType() {
|
||||
return "testType";
|
||||
}
|
||||
public String getComponentName() {
|
||||
return "testName";
|
||||
}
|
||||
};
|
||||
executor.execute(new Runnable() {
|
||||
public void run() {
|
||||
for (int i = 0; i < times; i++) {
|
||||
history.addEvent(component);
|
||||
otherHistory.addEvent(component);
|
||||
}
|
||||
}
|
||||
});
|
||||
executor.execute(new Runnable() {
|
||||
public void run() {
|
||||
for (int i = 0; i < times; i++) {
|
||||
history.toString();
|
||||
}
|
||||
}
|
||||
});
|
||||
executor.execute(new Runnable() {
|
||||
public void run() {
|
||||
for (int i = 0; i < times; i++) {
|
||||
history.hashCode();
|
||||
}
|
||||
}
|
||||
});
|
||||
executor.execute(new Runnable() {
|
||||
public void run() {
|
||||
for (int i = 0; i < times; i++) {
|
||||
history.equals(new Object());
|
||||
}
|
||||
}
|
||||
});
|
||||
executor.shutdown();
|
||||
executor.awaitTermination(3, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd">
|
||||
|
||||
<bean class="org.springframework.integration.history.MessageHistoryWriter"/>
|
||||
<bean class="org.springframework.integration.history.MessageHistoryWriter"/>
|
||||
<bean class="org.springframework.integration.context.MessageHistoryWriter"/>
|
||||
<bean class="org.springframework.integration.context.MessageHistoryWriter"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -30,5 +30,5 @@
|
||||
|
||||
<int:channel id="endOfThePipeChannel"/>
|
||||
|
||||
<bean class="org.springframework.integration.history.MessageHistoryWriter"/>
|
||||
<bean class="org.springframework.integration.context.MessageHistoryWriter"/>
|
||||
</beans>
|
||||
|
||||
@@ -38,11 +38,11 @@ import org.springframework.integration.MessageRejectedException;
|
||||
import org.springframework.integration.channel.MessagePublishingErrorHandler;
|
||||
import org.springframework.integration.context.BeanFactoryChannelResolver;
|
||||
import org.springframework.integration.context.IntegrationContextUtils;
|
||||
import org.springframework.integration.context.NamedComponent;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.endpoint.AbstractPollingEndpoint;
|
||||
import org.springframework.integration.history.NamedComponent;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.scheduling.support.PeriodicTrigger;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
Reference in New Issue
Block a user