public class PeriodicRecovery extends Thread
n.b. recovery scans may be performed by this object (it is a thread and may be started as a background task) and by other ad hoc threads
Modifier and Type | Class and Description |
---|---|
static class |
PeriodicRecovery.Mode
state values indicating operating mode of scanning process for ad hoc threads and controlling behaviour of
singleton periodic recovery thread.
|
static class |
PeriodicRecovery.Status
state values indicating whether or not some thread is currently scanning.
|
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
static int |
_defaultBackoffPeriod
default value for _backoffPeriod if not specified via RecoveryEnvironmentBean
|
static int |
_defaultRecoveryPeriod
default value for _recoveryPeriod if not specified via RecoveryEnvironmentBean
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
PeriodicRecovery(boolean threaded,
boolean useListener) |
Modifier and Type | Method and Description |
---|---|
void |
addModule(RecoveryModule module)
Add the specified module to the end of the recovery module list.
|
void |
doWork()
Perform a recovery scan on all registered modules.
|
Listener |
getListener() |
PeriodicRecovery.Mode |
getMode()
fetch the current recovery operation mode either ENABLED, SUSPENDED or TERMINATED
Caveats: must only be called while synchronized on
_stateLock |
Vector<RecoveryModule> |
getModules()
return a copy of the current recovery modules list
|
ServerSocket |
getServerSocket() |
void |
removeAllModules(boolean waitOnScan)
Remove all modules.
|
void |
removeModule(RecoveryModule module,
boolean waitOnScan)
remove a recovery module from the recovery modules list
|
void |
resumeScan()
resume scanning operations
This switches the recovery operation mode from SUSPENDED to RESUMED.
|
void |
run()
Implements the background thread which performs the periodic recovery
|
void |
shutdown(boolean async)
initiate termination of the periodic recovery thread and stop any subsequent scan requests from proceeding.
|
PeriodicRecovery.Mode |
suspendScan(boolean async)
make all scanning operations suspend.
|
void |
wakeUp()
called by the listener worker to wake the periodic recovery thread and get it to start a scan if one
is not already in progress
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public static final int _defaultBackoffPeriod
public static final int _defaultRecoveryPeriod
public PeriodicRecovery(boolean threaded, boolean useListener)
threaded
- useListener
- if true, start a socket based listener.public void shutdown(boolean async)
async
- false if the calling thread should wait for any in-progress scan to complete before returningpublic PeriodicRecovery.Mode suspendScan(boolean async)
async
- false if the calling thread should wait for any in-progress scan to complete before returningpublic void resumeScan()
public ServerSocket getServerSocket() throws IOException
IOException
- if the host name is unknown or the endpoint has already been boundpublic void run()
public final void doWork()
public void wakeUp()
public final void addModule(RecoveryModule module)
module
- The module to append.public final void removeModule(RecoveryModule module, boolean waitOnScan)
module
- the module to be removedwaitOnScan
- true if the remove operation should wait for any in-progress scan to completepublic final void removeAllModules(boolean waitOnScan)
waitOnScan
- true if the remove operation should wait for any in-progress scan to complete.public final Vector<RecoveryModule> getModules()
public Listener getListener()
public PeriodicRecovery.Mode getMode()
_stateLock
Copyright © 2021 JBoss by Red Hat. All rights reserved.