|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
org.opensubsystems.patterns.listdata.util.AsyncDataLoader
public class AsyncDataLoader
Thread used to load data asynchronously using list controller interface. The class, which wants to perform async data processing will usually derive new class inline and define method createAddItemsRunnable. TODO: Performance: We may want to convert this to Runnable and the user pool of threads to run them instead of creating new thread all the time.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static java.lang.String |
ASYNC_LOADER_PAGE_SIZE
Configuration setting for how many items to load at once when loading data in the background. |
static int |
ASYNC_LOADER_PAGE_SIZE_DEFAULT
Default value for how many items to load at once when loading data in the background. |
protected java.lang.Class |
m_clsListFactoryClassName
Class for the list factory to use. |
protected int |
m_iCurrentObjectVersion
Value uniquely identifying the current state of the object to which the data should be added. |
protected int |
m_iLoaderIdentification
Identification of this loader which is send back to owner to distinguish if there are multiple loader present. |
protected AsyncDataLoaderOwner |
m_owner
Owner which is loading with data using this thread. |
static java.lang.Runnable |
NOTHING_TO_DO
This object should be used as a placeholder when there is nothing to do to prevent creation of new objects and exhausting memory. |
protected static int |
s_iPageSize
How many items to load at once when loading data in the background. |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
AsyncDataLoader(int iLoaderIdentification,
AsyncDataLoaderOwner owner,
java.lang.Class clsListFactoryClassName,
int iObjectVersion)
Construct new loader. |
|
| Method Summary | |
|---|---|
protected void |
allDataLoaded()
This function is called where data loading finished. |
protected ListOptions |
getInitialListOptions()
Return the initial ListOptions structure used to load the list of data objects. |
protected ListController |
getListController()
Get list controller to use. |
protected void |
processData(java.util.List lstDataToAdd,
int iOriginalObjectVersion)
Process data which were asynchronously loaded. |
void |
run()
|
protected boolean |
stopLoading()
This method should return true if the async thread should stop loading data. |
| 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 |
|---|
public static final java.lang.String ASYNC_LOADER_PAGE_SIZE
public static final int ASYNC_LOADER_PAGE_SIZE_DEFAULT
public static final java.lang.Runnable NOTHING_TO_DO
protected int m_iLoaderIdentification
protected AsyncDataLoaderOwner m_owner
protected java.lang.Class m_clsListFactoryClassName
protected int m_iCurrentObjectVersion
protected static int s_iPageSize
| Constructor Detail |
|---|
public AsyncDataLoader(int iLoaderIdentification,
AsyncDataLoaderOwner owner,
java.lang.Class clsListFactoryClassName,
int iObjectVersion)
iLoaderIdentification - - identification of this loader which is send
back to owner to distinguish if there are
multiple loader presentowner - - owner of this data loader
TODO: Improve: It doesn't necessarily make sence for everybody to know
what factory class to userclsListFactoryClassName - - name of the class for the list factory
to useiObjectVersion - - value uniquely identifying the current state of the object
to which the data should be added| Method Detail |
|---|
public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadprotected ListOptions getInitialListOptions()
protected boolean stopLoading()
protected void processData(java.util.List lstDataToAdd,
int iOriginalObjectVersion)
lstDataToAdd - - list of data items to add to the containeriOriginalObjectVersion - - version of the object by which the data
should be processed, which is the version which was used to
construct this object. If the version of the object at the time when
the data are being processed is different from this version, then
the data will not be processed or the processing of the data stops.protected void allDataLoaded()
protected ListController getListController()
throws org.opensubsystems.core.error.OSSException
org.opensubsystems.core.error.OSSException - - an error has occured
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||