public abstract class EventLogLoader extends Object implements Iterator<EventLog>, Iterable<EventLog>, ApplicationListener
FullTextIndexer
which provides an
Iterator
interface for EventLog
instances to be properly
indexed. Also supports the concept of batches. After batchSize
queries,Modifier and Type | Field and Description |
---|---|
protected int |
batchSize |
static int |
DEFAULT_BATCH_SIZE
Currently 100.
|
protected List<String> |
excludes
Array of class types which will get excluded from indexing.
|
protected org.slf4j.Logger |
log |
protected String |
query
Query string to be kept in sync with
excludes . |
protected IQuery |
queryService |
Constructor and Description |
---|
EventLogLoader() |
Modifier and Type | Method and Description |
---|---|
boolean |
addEventLog(Class<? extends IObject> cls,
long id)
|
int |
getBatchSize() |
boolean |
hasNext()
Tests for available objects.
|
boolean |
isStopSet()
Returns true if the stop flag has been set on this instance.
|
Iterator<EventLog> |
iterator() |
EventLog |
lastEventLog() |
abstract long |
more()
Should return an estimate of how many more
EventLog instances are
available for processing. |
EventLog |
next()
|
EventLog |
nextEventLog(long id)
Returns the
EventLog with the next id after the given argument or
null if none exists. |
void |
onApplicationEvent(ApplicationEvent arg0) |
protected abstract EventLog |
query() |
void |
remove() |
void |
rollback(EventLog el) |
void |
setBatchSize(int batchSize)
Set the number of
EventLog instances will be loaded in a single
run. |
void |
setExcludes(String[] excludes)
Spring injector
|
void |
setQueryService(IQuery queryService)
Spring injector
|
void |
setStop(boolean stop)
Called by controlling objects (a worker thread) in order
to free up the thread.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
forEach, spliterator
protected final org.slf4j.Logger log
public static final int DEFAULT_BATCH_SIZE
protected int batchSize
protected List<String> excludes
protected String query
excludes
.initQueryString()
protected IQuery queryService
public void setBatchSize(int batchSize)
EventLog
instances will be loaded in a single
run. If not set, DEFAULT_BATCH_SIZE
will be used.batchSize
- public int getBatchSize()
public void setExcludes(String[] excludes)
public void setQueryService(IQuery queryService)
public boolean hasNext()
count
is -1, then this batch has
ended (set in next()
) and false will be returned,
EventBacklog
will be ready to be switched over to an "adding"
state if empty, andcount
is also reset so further calls can
finish normally; otherwise query()
is called to load a new
eventLog
. Otherwise, just tests that field for null.public EventLog next()
log
instance which may be loaded by a call
to hasNext()
if necessary. If hasNext()
returns false,
a NoSuchElementException
will be thrown.public void rollback(EventLog el)
protected abstract EventLog query()
public abstract long more()
EventLog
instances are
available for processing. Some implementations may attempt to take extra
measures if the number is too large. Use 1 for a constant rather than
Long.MAX_VALUE
. Use 0 to stop execution.public final EventLog nextEventLog(long id)
public final EventLog lastEventLog()
public void onApplicationEvent(ApplicationEvent arg0)
onApplicationEvent
in interface ApplicationListener
public boolean isStopSet()
public void setStop(boolean stop)
Version: 5.3.3-ice35-b63
Copyright © 2017 The University of Dundee & Open Microscopy Environment. All Rights Reserved.