StartOptions
- the type of the start scan optionsListener
- the type of scan listenerpublic abstract class BaseContextScannerThread<StartOptions extends ScanStartOptions,Listener extends ScanListener> extends BaseScannerThread<StartOptions>
BaseScannerThread
for scans done on Contexts
,
adding support for notifying a list of scan listeners
.BaseScannerThread
,
ScanListener
,
Context
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
protected int |
contextId |
protected Set<Listener> |
listeners |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
BaseContextScannerThread(int contextId)
Instantiates a new base context scanner thread for a Context with a given id.
|
Modifier and Type | Method and Description |
---|---|
void |
addScanListener(Listener l)
Adds a new scan listener.
|
protected void |
notifyScanFinished()
Notifies listeners that the scan has finished.
|
protected void |
notifyScanProgress()
Notifies listeners that the scan has changes it's progress.
|
protected void |
notifyScanStarted()
Notifies listeners that the scan has started.
|
void |
removeScanListener(Listener l)
Removes a scan listener.
|
void |
setScanProgress(int progress)
Sets the scan's progress, on a scale from 0 to
BaseScannerThread.getScanMaximumProgress() . |
checkPausedAndWait, getScanMaximumProgress, getScanProgress, getStartOptions, hasRun, isPaused, isRunning, pauseScan, resumeScan, run, scan, setPaused, setRunningState, setScanMaximumProgress, setStartOptions, start, startScan, stopScan
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, stop, stop, suspend, toString, yield
protected Set<Listener extends ScanListener> listeners
protected int contextId
public BaseContextScannerThread(int contextId)
contextId
- the context idpublic void addScanListener(Listener l)
l
- the listener to addpublic void removeScanListener(Listener l)
l
- the listener to removeprotected void notifyScanStarted()
protected void notifyScanFinished()
protected void notifyScanProgress()
setScanProgress(int)
).public void setScanProgress(int progress)
BaseScannerThread
BaseScannerThread.getScanMaximumProgress()
.setScanProgress
in class BaseScannerThread<StartOptions extends ScanStartOptions>
progress
- the new scan progress