Skip to content

Commit

Permalink
Added check for cleanup policy. Added log message when removing file.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcustenborder committed May 2, 2018
1 parent 3af4d58 commit e6c6ec4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,12 @@ public void start(Map<String, String> settings) {
this.config = config(settings);

checkDirectory(SpoolDirSourceConnectorConfig.INPUT_PATH_CONFIG, this.config.inputPath);
checkDirectory(SpoolDirSourceConnectorConfig.FINISHED_PATH_CONFIG, this.config.finishedPath);
checkDirectory(SpoolDirSourceConnectorConfig.ERROR_PATH_CONFIG, this.config.errorPath);

if (SpoolDirSourceConnectorConfig.CleanupPolicy.MOVE == this.config.cleanupPolicy) {
checkDirectory(SpoolDirSourceConnectorConfig.FINISHED_PATH_CONFIG, this.config.finishedPath);
}

this.parser = new Parser();
Map<Schema, TypeParser> dateTypeParsers = ImmutableMap.of(
Timestamp.SCHEMA, new TimestampTypeParser(this.config.parserTimestampTimezone, this.config.parserTimestampDateFormats),
Expand Down Expand Up @@ -288,6 +291,7 @@ private void closeAndDelete() throws IOException {
log.info("Closing {}", this.inputFile);
this.inputStream.close();
this.inputStream = null;
log.info("Removing file {}", this.inputFile);
this.inputFile.delete();
File processingFile = InputFileDequeue.processingFile(this.config.processingFileExtension, this.inputFile);
if (processingFile.exists()) {
Expand Down

0 comments on commit e6c6ec4

Please sign in to comment.