projects
/
jSite.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don’t delete lockfile on exit if file could not be locked.
[jSite.git]
/
src
/
de
/
todesbaum
/
jsite
/
main
/
Configuration.java
diff --git
a/src/de/todesbaum/jsite/main/Configuration.java
b/src/de/todesbaum/jsite/main/Configuration.java
index
3322c03
..
b38e986
100644
(file)
--- a/
src/de/todesbaum/jsite/main/Configuration.java
+++ b/
src/de/todesbaum/jsite/main/Configuration.java
@@
-113,9
+113,12
@@
public class Configuration {
return false;
}
File lockFile = new File(lockFilename);
return false;
}
File lockFile = new File(lockFilename);
- lockFile.deleteOnExit();
try {
try {
- return lockFile.createNewFile();
+ boolean fileLocked = lockFile.createNewFile();
+ if (fileLocked) {
+ lockFile.deleteOnExit();
+ }
+ return fileLocked;
} catch (IOException e) {
/* ignore. */
}
} catch (IOException e) {
/* ignore. */
}
@@
-123,6
+126,13
@@
public class Configuration {
}
/**
}
/**
+ * Tells the VM to remove the lock file on program exit.
+ */
+ public void removeLockfileOnExit() {
+ new File(lockFilename).deleteOnExit();
+ }
+
+ /**
* Reads the configuration from the file.
*/
private void readConfiguration() {
* Reads the configuration from the file.
*/
private void readConfiguration() {