|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread info.rolandkrueger.roklib.system.MemorySwappingDetectionThread
public abstract class MemorySwappingDetectionThread
Abstract class for implementations of threads that are able to detect memory
paging events on the local system. Subclasses of this class can implement
their own specific methods for detecting memory paging by providing an
implementation for the abstract method
isSwapEventDetected()
. This method is
repeatedly called during the lifetime of the detection thread.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
private MemorySwappingEventListener |
mListener
|
private boolean |
mStopRequest
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
MemorySwappingDetectionThread(MemorySwappingEventListener listener)
Constructor. |
Method Summary | |
---|---|
protected abstract boolean |
isSwapEventDetected()
Returns true if a memory paging event was detected |
protected void |
notifyListenerOfSwappingEvent()
If a swapping event was detected, this method notifies the MemorySwappingEventListener of that. |
void |
run()
During its execution, the swapping detection thread will repeatedly call isSwapEventDetected() and check if a
swapping event was detected. |
void |
stopThread()
Stop this thread. |
protected abstract void |
stopThreadImpl()
Implementations of this method define the actions that have to be taken prior to stopping this thread. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private MemorySwappingEventListener mListener
private boolean mStopRequest
Constructor Detail |
---|
public MemorySwappingDetectionThread(MemorySwappingEventListener listener)
listener
- class implementing the MemorySwappingEventListener
interface which will be notified of swapping eventsMethod Detail |
---|
protected abstract boolean isSwapEventDetected()
true
if a memory paging event was detected
true
if a memory paging event was detectedprotected abstract void stopThreadImpl()
public void run()
isSwapEventDetected()
and check if a
swapping event was detected. If so, the listener will be notified of this
event.isSwapEventDetected()
will be called
within a loop, you must take care that the implementation of this method
will block the thread for a reasonable amount of time (e.g., via
Thread.sleep(long)
. Otherwise this thread will consume too much CPU
time through the 'busy wait'.
run
in interface Runnable
run
in class Thread
protected void notifyListenerOfSwappingEvent()
MemorySwappingEventListener
of that.
public final void stopThread()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |