public abstract class Daemon extends Object implements Runnable
Daemon
object provides a named thread which will
execute the run
method when started. This offers
some convenience in that it hides the normal thread methods and
also allows the object extending this to provide the name of the
internal thread, which is given an incrementing sequence number
appended to the name provided.Modifier | Constructor and Description |
---|---|
protected |
Daemon()
Constructor for the
Daemon object. |
Modifier and Type | Method and Description |
---|---|
void |
interrupt()
This is used to interrupt the internal thread.
|
boolean |
isActive()
This is used to determine if the runner is active.
|
void |
start()
This is used to start the internal thread.
|
void |
stop()
This method is used to stop the thread without forcing it to
stop.
|
protected Daemon()
Daemon
object. This will
create the internal thread and ensure it is a daemon. When it
is started the name of the internal thread is set using the
name of the instance as taken from getName
. If
the name provided is null then no name is set for the thread.public boolean isActive()
public void start()
run
method of
this instance. Aside from starting the thread this will also
ensure the internal thread has a unique name.public void interrupt()
public void stop()
isActive
method
is checked to determine whether it should continue to run.Copyright © 2023. All rights reserved.