Home > Contents > Index >
Utilities.lockFile
Locks a file for exclusive use by this thread.
Syntax
public static boolean lockFile(String file)Parameters
file
- Filename to lock. This must be a file specification that is valid for the operating system.
Description
The lockFile method locks a file for exclusive use by this thread.
Don't forget to release the lock. Otherwise, it is held until the virtual machine shuts down.
lockFile()
andunlockFile()
provide a semaphore primitive that is useful in a cluster environment.Returns
Boolean indicating success or failure.
See Also
Home > Contents > Index > ![]()
Oracle JAVA Reference
Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.