0

您将如何检测两个(在我的情况下为 java)进程是否可以共同访问至少一个文件系统?(可能包括网络共享文件系统)。

假设它们可能在共享磁盘的两台机器上,在不同的机器上,或者只是在同一台机器上的两个进程。我很想保持我的进程具有正常的用户权限,所以假设我不能在所有文件系统的根目录中写入文件来跟踪这一点。

也许以某种方式使用临时目录。

4

1 回答 1

1

Don't. If they're on separate machines passing data through the filesystem will be a lot slower than a simple socket connection. If they're on the same system the socket connection will not involve the network physical layer and will likely also be faster than using disk.

Using disk and having to manage two transports is just introducing complexity for no reason.

于 2013-10-02T15:59:03.077 回答