|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.ibm.jtopenlite.ddm.DDMThreadedReader
public abstract class DDMThreadedReader
A special kind of DDMReadCallback you can use when you want multiple
threads to simultaneously process data being read out of the same file and connection. The data is read by the main thread,
but the conversion is done by one or more processing threads. Subclass this class and implement the
process() method to read record data off-thread from the main I/O thread.
This gives the performance advantage of streaming data from the server in parallel with processing said data.
It is important to note that using more than one thread will likely cause the records to be processed out-of-order.
| Constructor Summary | |
|---|---|
DDMThreadedReader(DDMRecordFormat format,
DDMFile file,
int numThreads)
Constructs a multi-threaded reader to process data being read from the specified file using the specified record format. |
|
| Method Summary | |
|---|---|
void |
endOfFile(DDMCallbackEvent event)
Do not call this method directly; it is implemented for DDMConnection to call. |
boolean |
isDone()
Indicates if end-of-file has been reached and our threads have been shutdown. |
void |
newRecord(DDMCallbackEvent event,
DDMDataBuffer buffer)
Do not call this method directly; it is implemented for DDMConnection to call. |
abstract void |
process(DDMRecordFormat format,
DDMDataBuffer dataBuffer)
Override this method with your own record processing logic. |
void |
recordNotFound(DDMCallbackEvent event)
Do not call this method directly; it is implemented for DDMConnection to call. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DDMThreadedReader(DDMRecordFormat format,
DDMFile file,
int numThreads)
format - The record format to copy and give to each thread for it to pass to process().file - The file being read.numThreads - The number of threads to use. This number is capped by the number of buffers in the file object, so
that each thread always has at least one buffer to process, to avoid contention. Having more than one buffer per thread is fine.| Method Detail |
|---|
public final void newRecord(DDMCallbackEvent event,
DDMDataBuffer buffer)
newRecord in interface DDMReadCallbackpublic final void recordNotFound(DDMCallbackEvent event)
recordNotFound in interface DDMReadCallbackpublic final void endOfFile(DDMCallbackEvent event)
endOfFile in interface DDMReadCallbackpublic final boolean isDone()
public abstract void process(DDMRecordFormat format,
DDMDataBuffer dataBuffer)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||