public abstract class DaemonThread extends java.lang.Object implements DaemonRunner, java.lang.Runnable, ExceptionListenerUser
Modifier and Type | Field and Description |
---|---|
protected EnvironmentImpl |
envImpl |
protected java.util.logging.Logger |
logger |
protected java.lang.String |
name |
protected int |
nWakeupRequests |
static boolean |
stifleExceptionChatter |
Constructor and Description |
---|
DaemonThread(long waitTime,
java.lang.String name,
EnvironmentImpl envImpl) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkErrorListener(java.lang.Throwable e)
If Daemon Thread throws errors and exceptions, this function will catch
it and throw a EnvironmentFailureException, and fail the test.
|
protected java.util.logging.Logger |
createLogger() |
ExceptionListener |
getExceptionListener()
For testing.
|
int |
getNWakeupRequests()
For unit testing.
|
java.lang.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 |
setExceptionListener(ExceptionListener exceptionListener) |
void |
shutdown()
Requests shutdown and calls join() to wait for the thread to stop.
|
java.lang.String |
toString() |
void |
wakeup() |
protected java.lang.String name
protected int nWakeupRequests
public static boolean stifleExceptionChatter
protected EnvironmentImpl envImpl
protected final java.util.logging.Logger logger
public DaemonThread(long waitTime, java.lang.String name, EnvironmentImpl envImpl)
public void setExceptionListener(ExceptionListener exceptionListener)
setExceptionListener
in interface DaemonRunner
setExceptionListener
in interface ExceptionListenerUser
protected java.util.logging.Logger createLogger()
public ExceptionListener getExceptionListener()
public java.lang.Thread getThread()
public void runOrPause(boolean run)
runOrPause
in interface DaemonRunner
public void requestShutdown()
requestShutdown
in interface DaemonRunner
public void shutdown()
shutdown
in interface DaemonRunner
public java.lang.String toString()
toString
in class java.lang.Object
public void wakeup()
public void run()
run
in interface java.lang.Runnable
public boolean checkErrorListener(java.lang.Throwable e)
protected long nDeadlockRetries()
protected abstract void onWakeup() throws DatabaseException
DatabaseException
protected boolean isShutdownRequested()
protected boolean isPaused()
public boolean isRunning()
public int getNWakeupRequests()
getNWakeupRequests
in interface DaemonRunner
Copyright (c) 2004-2012 Oracle. All rights reserved.