keedio/flume-taildirectory-source

Only one file are being released due bad loop implementation

Closed this issue · 0 comments

for (FileSet fileSet: fileSetMap.values()){

                    [.......]
                    if (currentTime - lastAppendTime > TimeUnit.MINUTES.toMillis(timeToUnlockFile)){
                        logger.info("File: " + fileSet.getFilePath() + 
                                " not modified after " + timeToUnlockFile + " minutes" +
                                " removing from monitoring list");
                        fileSetMap.get(fileKey).clear();
                        fileSetMap.get(fileKey).close();
                        fileSetMap.remove(fileKey);
                        filePathsAndKeys.remove(fileSet.getFilePath().toString());
                    }
                }

Check this line, not possible to remove a item for hahsmap being looped
fileSetMap.remove(fileKey);