public class FileLockSimulator extends Object
Usage: java FileLockSimulator instanceName pathToLogFile delay where "instanceName" is the name given to the current instance of the application "pathToLogFile" is the path to the log file "delay" is the number of milliseconds of sleep observed every 128 writesThis small application requires only the JDK to compile and to execute.
FileLockSimulator should be launched as many times and from as many hosts as there will be JVMs writing to a log file in prudent mode. Performance should be quite good if "pathToLogFile" is on a local file system. On networked file systems such as NFS, performance depends on the speed of the network and NFS implementation. It has been observed that file locking over NFS is biased so that the current owner of the lock is favored over other processes. Thus, while one process hogs the lock for the log file, other processes starve waiting for the lock to the point of appearing deadlocked.
Constructor and Description |
---|
FileLockSimulator() |
public FileLockSimulator()
public static void main(String[] args) throws IOException, InterruptedException
IOException
InterruptedException
Copyright © 2005–2018 QOS.ch. All rights reserved.