| Constructor and Description |
|---|
Daemon() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
getThreadName()
Return the name for this thread
|
boolean |
isRunning()
Returns whether the daemon is in the process of terminating
|
boolean |
isThreadRunning()
Determines if this daemon's thread is alive
|
protected boolean |
shouldStartAsDaemon()
Overloading this method to return true will start this daemon's thread as a Daemon Thread
|
Thread |
startThread()
Starts this daemon, creating a new thread for it (the name of which will be set to the SimpleName of its class)
|
Thread |
startThread(String name)
Starts this daemon, creating a new thread for it
|
static void |
stopAll(List<? extends Daemon> daemons)
Stop all the daemons in a given list:
|
void |
stopThread()
Requests the daemon terminate by setting a flag and sending an interrupt to the thread
|
static boolean |
waitForTermination(Daemon daemon,
long timeoutMillis) |
static boolean |
waitForTermination(List<? extends Daemon> daemons,
long timeoutMillis) |
public Thread startThread() throws IllegalThreadStateException
IllegalThreadStateException - If the daemon is still runningprotected String getThreadName()
public Thread startThread(String name) throws IllegalThreadStateException
name - String The name for the threadIllegalThreadStateException - If the daemon is still runningpublic boolean isRunning()
public void stopThread()
public boolean isThreadRunning()
protected boolean shouldStartAsDaemon()
public static void stopAll(List<? extends Daemon> daemons)
daemons - List[Daemon] The daemons to stoppublic static boolean waitForTermination(Daemon daemon, long timeoutMillis)
Copyright © 2017. All rights reserved.