From 0da9baf26d3dee444f74a39ee3684bc37e1fcf9f Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Wed, 15 Aug 2012 16:00:13 -0400 Subject: [PATCH] INT-2702 Mail ThreadLocal Polishing Change set(null) to remove() Eliminate folder close from destroy() method. It no longer makes sense to do that there. --- .../integration/mail/AbstractMailReceiver.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java index a02b72bf2a..06581db583 100755 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java @@ -321,7 +321,6 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl } public synchronized void destroy() throws Exception { - MailTransportUtils.closeFolder(this.contextHolder.get().getFolder(), this.shouldDeleteMessages); MailTransportUtils.closeService(this.store); this.store = null; this.initialized = false; @@ -411,7 +410,7 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl } Folder folder = context.getFolder(); MailTransportUtils.closeFolder(folder, this.shouldDeleteMessages); - this.contextHolder.set(null); + this.contextHolder.remove(); if (exceptionToThrow != null) { throw exceptionToThrow; } @@ -420,7 +419,7 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl public void closeContextAfterFailure(MailReceiverContext context) { Assert.notNull(context, "Mail Reader Context cannot be null"); MailTransportUtils.closeFolder(context.getFolder(), false); - this.contextHolder.set(null); + this.contextHolder.remove(); } }