Clear lock cache in NioFileLocker (#2998)

Fixes https://github.com/spring-projects/spring-integration/issues/2980
This commit is contained in:
Gary Russell
2019-07-22 15:10:18 -04:00
committed by Artem Bilan
parent 084aaf7e57
commit 8bb0e194c0
3 changed files with 15 additions and 6 deletions

View File

@@ -34,7 +34,7 @@ import java.util.concurrent.ConcurrentMap;
*/
final class FileChannelCache {
private static ConcurrentMap<File, FileChannel> channelCache = new ConcurrentHashMap<File, FileChannel>();
private static ConcurrentMap<File, FileChannel> channelCache = new ConcurrentHashMap<>();
private FileChannelCache() {

View File

@@ -40,7 +40,7 @@ import org.springframework.messaging.MessagingException;
*/
public class NioFileLocker extends AbstractFileLockerFilter {
private final ConcurrentMap<File, FileLock> lockCache = new ConcurrentHashMap<File, FileLock>();
private final ConcurrentMap<File, FileLock> lockCache = new ConcurrentHashMap<>();
@Override
public boolean lock(File fileToLock) {
@@ -68,7 +68,7 @@ public class NioFileLocker extends AbstractFileLockerFilter {
@Override
public void unlock(File fileToUnlock) {
FileLock fileLock = this.lockCache.get(fileToUnlock);
FileLock fileLock = this.lockCache.remove(fileToUnlock);
try {
if (fileLock != null) {
fileLock.release();