diff --git a/spring-integration-jms/.springBeans b/spring-integration-jms/.springBeans index 7b959d0f8f..bafca86c72 100644 --- a/spring-integration-jms/.springBeans +++ b/spring-integration-jms/.springBeans @@ -8,6 +8,7 @@ src/test/java/org/springframework/integration/jms/config/GlobalChannelInterceptorTests-context.xml + src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests-context.xml diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests-context.xml b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests-context.xml new file mode 100644 index 0000000000..69c34c0f43 --- /dev/null +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests-context.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests.java index bf6a9ee889..6aad4781b0 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/config/JmsChannelHistoryTests.java @@ -26,7 +26,11 @@ import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.Message; +import org.springframework.integration.core.PollableChannel; +import org.springframework.integration.core.SubscribableChannel; import org.springframework.integration.history.MessageHistory; import org.springframework.integration.jms.SubscribableJmsChannel; import org.springframework.integration.message.GenericMessage; @@ -61,4 +65,16 @@ public class JmsChannelHistoryTests { channel.send(message); verify(template, times(1)).convertAndSend(Mockito.any(Message.class)); } + + @Test + public void testFullConfig() throws Exception{ + ActiveMqTestUtils.prepare(); + ApplicationContext ac = new ClassPathXmlApplicationContext("JmsChannelHistoryTests-context.xml", this.getClass()); + SubscribableChannel channel = ac.getBean("jmsChannel", SubscribableChannel.class); + PollableChannel resultChannel = ac.getBean("resultChannel", PollableChannel.class); + channel.send(new GenericMessage("hello")); + Message resultMessage = resultChannel.receive(5000); + MessageHistory history = MessageHistory.read(resultMessage); + assertTrue(history.get(0).contains("jmsChannel")); + } } diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java index ad2e6bfed6..f534374d25 100755 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java @@ -160,14 +160,11 @@ public class ImapIdleChannelAdapter extends MessageProducerSupport { return "mail:imap-idle-channel-adapter"; } - private void waitToReconnect() { + private void waitToReconnect() throws InterruptedException{ CountDownLatch latch = new CountDownLatch(1); - try { - logger.warn("Waiting " + reconnectDelay + " seconds before attemptong to reconnect to host"); - latch.await(this.reconnectDelay, TimeUnit.SECONDS); - reconnecting = true; - logger.warn("Will attempt to reconnect to host now"); - } catch (Exception ignore) { - } + logger.warn("Waiting " + reconnectDelay + " seconds before attemptong to reconnect to host"); + latch.await(this.reconnectDelay, TimeUnit.SECONDS); + reconnecting = true; + logger.warn("Will attempt to reconnect to host now"); } }