public final class PidFile
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static PidFile |
create(java.nio.file.Path path,
boolean deleteOnExit)
Creates a new PidFile and writes the current process ID into the provided path
|
java.nio.file.Path |
getPath()
Returns the process id file path
|
long |
getPid()
Returns the current process id
|
boolean |
isDeleteOnExit()
Returns
true iff the process id file is deleted on system exit. |
public static PidFile create(java.nio.file.Path path, boolean deleteOnExit) throws java.io.IOException
path
- the path to the pid file. The file is newly created or truncated if it already existsdeleteOnExit
- if true
the pid file is deleted with best effort on system exitjava.io.IOException
- if an IOException occurspublic long getPid()
public java.nio.file.Path getPath()
public boolean isDeleteOnExit()
true
iff the process id file is deleted on system exit. Otherwise false
.