diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/VetoCapableInterceptor.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/VetoCapableInterceptor.java index a6536b7a1e..2ea43a8ccc 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/VetoCapableInterceptor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/VetoCapableInterceptor.java @@ -20,7 +20,7 @@ import org.springframework.messaging.support.ChannelInterceptor; /** * {@link ChannelInterceptor}s implementing this interface can veto - * global interception of a particular channel name. Could be used, for example, + * global interception of a particular channel. Could be used, for example, * when an interceptor itself writes to an output channel (which should * not be intercepted with this interceptor). * @@ -32,6 +32,7 @@ public interface VetoCapableInterceptor { /** * @param beanName The channel name. + * @param channel The channel that is about to be intercepted. * @return false if the intercept wishes to veto the interception. */ boolean shouldIntercept(String beanName, ChannelInterceptorAware channel); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java index 9563d274f0..3afce01490 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/interceptor/ChannelInterceptorTests.java @@ -23,7 +23,6 @@ import static org.junit.Assert.assertSame; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; @@ -53,23 +52,6 @@ public class ChannelInterceptorTests { private final QueueChannel channel = new QueueChannel(); - @Test - public void test() { - final AtomicInteger bar = new AtomicInteger(); - for (int i = 0; i < 1000000000; i++) { - List foo = getFoo(); - if (foo.size() > 0) { - for (String baz : foo) { - bar.incrementAndGet(); - } - } - } - } - - protected List getFoo() { - List foo = new ArrayList(); - return foo; - } @Test public void testPreSendInterceptorReturnsMessage() { diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/registry/HeaderChannelRegistryTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/registry/HeaderChannelRegistryTests.java index ff1e616d41..9a3d1511a9 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/registry/HeaderChannelRegistryTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/registry/HeaderChannelRegistryTests.java @@ -51,6 +51,7 @@ import org.springframework.messaging.core.DestinationResolutionException; import org.springframework.messaging.support.ErrorMessage; import org.springframework.messaging.support.GenericMessage; import org.springframework.scheduling.TaskScheduler; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -61,6 +62,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; */ @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) +@DirtiesContext public class HeaderChannelRegistryTests { @Autowired @@ -147,9 +149,11 @@ public class HeaderChannelRegistryTests { DefaultHeaderChannelRegistry registry = new DefaultHeaderChannelRegistry(50); registry.setTaskScheduler(this.taskScheduler); registry.start(); - Thread.sleep(200); String id = (String) registry.channelToChannelName(new DirectChannel()); - Thread.sleep(300); + int n = 0; + while (n++ < 100 && registry.channelNameToChannel(id) != null) { + Thread.sleep(100); + } assertNull(registry.channelNameToChannel(id)); registry.stop(); }