|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
org.opensubsystems.core.util.AsyncProcessor
public class AsyncProcessor
Thread used to asynchronously process items added to the queue. The items are processesed in the order as the are added to the queue and the thread blocks if the queue is empty. The class, which wants to perform async data processing will usually inline derive new class and define method processIte. This class cannot be abstract so that we can do the in place overriding using anonymous classes.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected boolean |
m_bKeepRunning
By setting this flag to false we can stop the thread. |
protected SynchronizedQueue |
m_syncQueue
Synchronized queue use to keep data which should be processed asynchroneously. |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
AsyncProcessor(java.lang.String strName)
Default constructor |
|
| Method Summary | |
|---|---|
void |
processItemLater(java.lang.Object objItem)
Add item to the queue to be processed later. |
protected void |
processItemNow(java.lang.Object objItem)
Process item which was placed into the queue in processItemLater. |
void |
run()
Method called during thread execution. |
void |
stopProcessing()
Stop processing done by this thread as soon as possible |
| 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 |
|---|
protected SynchronizedQueue m_syncQueue
protected boolean m_bKeepRunning
| Constructor Detail |
|---|
public AsyncProcessor(java.lang.String strName)
strName - - name of this processor| Method Detail |
|---|
public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void stopProcessing()
public void processItemLater(java.lang.Object objItem)
objItem - - item to process, this might be null if null was put into
the queue
protected void processItemNow(java.lang.Object objItem)
throws OSSException
objItem - - item to process, this might be null if null was put into
the queue
OSSException - - an error has occured
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||