From a2b9ec18a03061a76d3cecafb7b078a6749fab97 Mon Sep 17 00:00:00 2001 From: Iwein Fuld Date: Tue, 3 Feb 2009 18:49:38 +0000 Subject: [PATCH] polishing --- .../integration/file/AcceptOnceFileListFilter.java | 2 ++ .../integration/file/FileReadingMessageSource.java | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/AcceptOnceFileListFilter.java b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/AcceptOnceFileListFilter.java index ec2afba1f1..fad4f5bef5 100644 --- a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/AcceptOnceFileListFilter.java +++ b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/AcceptOnceFileListFilter.java @@ -24,6 +24,8 @@ import java.util.concurrent.LinkedBlockingQueue; * {@link FileListFilter} that passes files only one time. This can * conveniently be used to prevent duplication of files, as is done in * {@link FileReadingMessageSource}. + *

+ * This implementation is thread safe. * * @author Iwein Fuld */ diff --git a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/FileReadingMessageSource.java b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/FileReadingMessageSource.java index 01bb835bf9..0fa09c8f5d 100644 --- a/org.springframework.integration.file/src/main/java/org/springframework/integration/file/FileReadingMessageSource.java +++ b/org.springframework.integration.file/src/main/java/org/springframework/integration/file/FileReadingMessageSource.java @@ -17,7 +17,6 @@ package org.springframework.integration.file; import java.io.File; -import java.io.FileFilter; import java.io.IOException; import java.util.Comparator; import java.util.HashSet; @@ -32,7 +31,7 @@ import org.springframework.core.io.Resource; import org.springframework.integration.aggregator.Resequencer; import org.springframework.integration.core.Message; import org.springframework.integration.core.MessagingException; -import org.springframework.integration.message.GenericMessage; +import org.springframework.integration.message.MessageBuilder; import org.springframework.integration.message.MessageSource; import org.springframework.util.Assert; @@ -108,13 +107,13 @@ public class FileReadingMessageSource implements MessageSource { } /** - * Sets a {@link FileFilter} on the {@link PollableSource}. By default a + * Sets a {@link FileListFilter}. By default a * {@link AcceptOnceFileListFilter} with no bounds is used. In most cases a - * customized {@link FileFilter} will be needed to deal with modification + * customized {@link FileListFilter} will be needed to deal with modification * and duplication concerns. If multiple filters are required a * {@link CompositeFileListFilter} can be used to group them together *

- * Note that the supplied filter must be thread safe.. + * The supplied filter must be thread safe.. */ public void setFilter(FileListFilter filter) { Assert.notNull(filter, "'filter' should not be null"); @@ -127,7 +126,7 @@ public class FileReadingMessageSource implements MessageSource { File file = toBeReceived.poll(); // we can't rely on isEmpty for concurrency reasons if (file != null) { - message = new GenericMessage(file); + message = MessageBuilder.withPayload(file).build(); if (logger.isInfoEnabled()) { logger.info("Created message: [" + message + "]"); }