Clear lock cache in NioFileLocker (#2998)
Fixes https://github.com/spring-projects/spring-integration/issues/2980
This commit is contained in:
committed by
Artem Bilan
parent
084aaf7e57
commit
8bb0e194c0
@@ -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() {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user