public abstract class DaemonThread extends Object implements DaemonRunner, Runnable
| Modifier and Type | Field and Description |
|---|---|
protected EnvironmentImpl |
envImpl |
protected Logger |
logger |
protected String |
name |
protected int |
nWakeupRequests |
static boolean |
stifleExceptionChatter |
| Constructor and Description |
|---|
DaemonThread(long waitTime,
String name,
EnvironmentImpl envImpl) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkErrorListener(Throwable e)
If Daemon Thread throws errors and exceptions, this function will catch
it and throw a EnvironmentFailureException, and fail the test.
|
protected Logger |
createLogger() |
int |
getNWakeupRequests()
For unit testing.
|
Thread |
getThread()
For testing.
|
protected boolean |
isPaused()
Returns whether the daemon is currently paused/disabled.
|
boolean |
isRunning()
Returns whether the onWakeup method is currently executing.
|
protected boolean |
isShutdownRequested()
Returns whether shutdown has been requested.
|
protected long |
nDeadlockRetries()
Returns the number of retries to perform when Deadlock Exceptions
occur.
|
protected abstract void |
onWakeup()
onWakeup is synchronized to ensure that multiple invocations of the
DaemonThread aren't made.
|
void |
requestShutdown() |
void |
run() |
void |
runOrPause(boolean run)
If run is true, starts the thread if not started or unpauses it
if already started; if run is false, pauses the thread if
started or does nothing if not started.
|
void |
setWaitTime(long waitTime) |
void |
shutdown()
Requests shutdown and calls join() to wait for the thread to stop.
|
String |
toString() |
void |
wakeup() |
protected String name
protected int nWakeupRequests
public static boolean stifleExceptionChatter
protected final EnvironmentImpl envImpl
protected final Logger logger
public DaemonThread(long waitTime,
String name,
EnvironmentImpl envImpl)
protected Logger createLogger()
public Thread getThread()
public void runOrPause(boolean run)
runOrPause in interface DaemonRunnerpublic void requestShutdown()
requestShutdown in interface DaemonRunnerpublic void shutdown()
shutdown in interface DaemonRunnerpublic void wakeup()
public boolean checkErrorListener(Throwable e)
protected long nDeadlockRetries()
protected abstract void onWakeup()
throws DatabaseException
DatabaseExceptionprotected boolean isShutdownRequested()
protected boolean isPaused()
public boolean isRunning()
public void setWaitTime(long waitTime)
public int getNWakeupRequests()
getNWakeupRequests in interface DaemonRunnerCopyright © 2024. All rights reserved.