Okay, so I'm unsure how mounts over a network work with file locks.
This is the scenario:
There are two JVMs, each running on a machine of its own (both Linux).
Then there is a file share, on a third machine (Windows).
Both the machines running a JVM each have mounted the same windows fileshare using CIFS/SAMBA.
If JVM-1 takes a lock on a file, using the FileLocker from Spring Integration for example, in its "local network mount" (or however to phrase it), will JVM-2 recognise that lock?
Or will the lock only be taken on that file local to the Linux machine, even though it is network share mounted and is bound somehow to a file on the Windows machine?
The NIOFileLocker
essentially works properly only on Windows. It doesn't matter how you mount that remote Windows dir, you stil work from Linux. Moreover you said it yourself: you deal with files via SMB protocol - nothing about local filesystem where NIOFileLocker
would have an effect.
See Spring Integration SMB support: https://docs.spring.io/spring-integration/docs/current/reference/html/smb.html#smb and consider to use an SmbPersistentAcceptOnceFileListFilter
based on some shared persistent DB: https://docs.spring.io/spring-integration/docs/current/reference/html/meta-data-store.html#metadata-store. The filter will look into the store to check if file has been already processed in some other instance. This is essentially a distributed file locking you are looking for.