polishing
This commit is contained in:
@@ -24,6 +24,8 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||||||
* {@link FileListFilter} that passes files only one time. This can
|
* {@link FileListFilter} that passes files only one time. This can
|
||||||
* conveniently be used to prevent duplication of files, as is done in
|
* conveniently be used to prevent duplication of files, as is done in
|
||||||
* {@link FileReadingMessageSource}.
|
* {@link FileReadingMessageSource}.
|
||||||
|
* <p/>
|
||||||
|
* This implementation is thread safe.
|
||||||
*
|
*
|
||||||
* @author Iwein Fuld
|
* @author Iwein Fuld
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package org.springframework.integration.file;
|
package org.springframework.integration.file;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileFilter;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -32,7 +31,7 @@ import org.springframework.core.io.Resource;
|
|||||||
import org.springframework.integration.aggregator.Resequencer;
|
import org.springframework.integration.aggregator.Resequencer;
|
||||||
import org.springframework.integration.core.Message;
|
import org.springframework.integration.core.Message;
|
||||||
import org.springframework.integration.core.MessagingException;
|
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.integration.message.MessageSource;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
@@ -108,13 +107,13 @@ public class FileReadingMessageSource implements MessageSource<File> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* {@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
|
* and duplication concerns. If multiple filters are required a
|
||||||
* {@link CompositeFileListFilter} can be used to group them together
|
* {@link CompositeFileListFilter} can be used to group them together
|
||||||
* <p/>
|
* <p/>
|
||||||
* <b>Note that the supplied filter must be thread safe.</b>.
|
* <b>The supplied filter must be thread safe.</b>.
|
||||||
*/
|
*/
|
||||||
public void setFilter(FileListFilter filter) {
|
public void setFilter(FileListFilter filter) {
|
||||||
Assert.notNull(filter, "'filter' should not be null");
|
Assert.notNull(filter, "'filter' should not be null");
|
||||||
@@ -127,7 +126,7 @@ public class FileReadingMessageSource implements MessageSource<File> {
|
|||||||
File file = toBeReceived.poll();
|
File file = toBeReceived.poll();
|
||||||
// we can't rely on isEmpty for concurrency reasons
|
// we can't rely on isEmpty for concurrency reasons
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
message = new GenericMessage<File>(file);
|
message = MessageBuilder.withPayload(file).build();
|
||||||
if (logger.isInfoEnabled()) {
|
if (logger.isInfoEnabled()) {
|
||||||
logger.info("Created message: [" + message + "]");
|
logger.info("Created message: [" + message + "]");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user