public class ConcurrentRecordLoop extends DefaultRecordLoop
RecordLoop
capable of processing records in multiple threads.
If this loop is constructed with isInteractive flag set to true,
all LoopEvent
s (but not RecordEvent
s) will be dispatched in the AWT
event processing thread, and the looping code (including fetching records from the
record source) will be run by loopExecutor.
If the number of record processing threads is higher than zero, a thread pool with
the specified maximum number of threads will be used to supply RecordEvent
s
to listeners while executing GO
and GO_N
commands.RecordLoop.Command, RecordLoop.Event, RecordLoop.State
Constructor and Description |
---|
ConcurrentRecordLoop(boolean isInteractive,
int nThreads)
Constructs ConcurrentRecordLoop with default looping code executor and thread factory.
|
ConcurrentRecordLoop(boolean isInteractive,
int nThreads,
Executor loopExecutor,
ThreadFactory threadFactory)
Constructs ConcurrentRecordLoop.
|
Modifier and Type | Method and Description |
---|---|
boolean |
doNotCount(Object record)
If the specified record is being currently supplied to listeners, tells this loop not to count
it towards the number of records that will be reported by getTotalCountableSupplied().
|
void |
setNumberOfThreads(int nThreads)
Sets the number of worker threads used by this record loop.
|
addLoopListener, addRecordListener, dispose, execute, getConsumed, getCountableConsumed, getLastRecord, getLoopListeners, getProgress, getRecordListeners, getRecordSource, getState, getSupplied, getTotalConsumed, getTotalCountableConsumed, getTotalSupplied, isEnabled, isInterruptRequested, removeLoopListener, removeRecordListener, setConfiguration, setProgressByRecords, setProgressByTime, setRecordSource, setStopOnEOF, setStopOnRewind
public ConcurrentRecordLoop(boolean isInteractive, int nThreads, Executor loopExecutor, ThreadFactory threadFactory)
isInteractive
- Interactivity flag - typically set to true in GUI-driven applications.nThreads
- Number of worker threads for record processing.loopExecutor
- Executor for running looping code in GUI-driven applications.
Not used unless the interactivity flag is set to true.threadFactory
- Factory for creating worker threads that will be running RecordListener
code.public ConcurrentRecordLoop(boolean isInteractive, int nThreads)
public void setNumberOfThreads(int nThreads)
IllegalStateException
- if this loop is in LOOPING
state.public boolean doNotCount(Object record)
DefaultRecordLoop
doNotCount
in interface RecordLoop
doNotCount
in class DefaultRecordLoop
Copyright © 2000-2012 FreeHEP. All Rights Reserved.