public class EventLogQueue extends PersistentEventLogLoader
PersistentEventLogLoader
implementation which loads many rows at the
same time, culling out duplicates in order to speed up indexing. Many of the
methods used by either PersistentEventLogLoader
or its super-classes
are not intended for use here. Instead, the Iterator
interface is
most critical. As with other implementations, hasNext()
is used for
loading data if necessary, while next()
simply returns an object. In
some cases, nulls may be returned, which consumers must contend with.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX
Default maximum for the number of rows that will be loaded in a single
call to
SqlAction.getEventLogPartitions(java.util.Collection, java.util.Collection, long, long)
. |
key, sql
batchSize, DEFAULT_BATCH_SIZE, excludes, log, query, queryService
Constructor and Description |
---|
EventLogQueue() |
EventLogQueue(Metrics metrics,
int max,
java.lang.String[] types,
java.lang.String[] actions) |
Modifier and Type | Method and Description |
---|---|
boolean |
addEventLog(java.lang.Class<? extends IObject> cls,
long id)
Only schedule a new backlog event if there is no currently registered
event of that type.
|
boolean |
hasNext()
Checks if either any
EventLogQueue.Entry instances are available or tries
to load them if not. |
void |
initialize()
Do nothing.
|
protected int |
load(java.util.List<java.lang.Object[]> rows) |
protected boolean |
load(java.lang.Long eventLogId,
java.lang.String type,
java.lang.Long objId,
java.lang.String action,
java.lang.Integer skipped)
Guarantees that the given arguments are available somewhere in the queue
returning true if they were newly added.
|
protected java.util.List<java.lang.Object[]> |
lookup() |
long |
more()
In general,
EventLogQueue will intend to use much larger batch
sizes, and so further loops should likely not be attempted. |
EventLog |
next()
Return a wrapped version of
EventLogQueue.Data.next() which could possibly be
null. |
void |
onApplicationEvent(org.springframework.context.ApplicationEvent arg0) |
protected EventLog |
query() |
deleteCurrentId, getCurrentId, getKey, setCurrentId, setKey, setSqlAction, setTypes
getBatchSize, isStopSet, iterator, lastEventLog, nextEventLog, remove, rollback, setBatchSize, setExcludes, setQueryService, setStop
public static final int DEFAULT_MAX
SqlAction.getEventLogPartitions(java.util.Collection, java.util.Collection, long, long)
. Currently 1 million.public EventLogQueue()
public EventLogQueue(Metrics metrics, int max, java.lang.String[] types, java.lang.String[] actions)
protected java.util.List<java.lang.Object[]> lookup()
protected int load(java.util.List<java.lang.Object[]> rows)
protected boolean load(java.lang.Long eventLogId, java.lang.String type, java.lang.Long objId, java.lang.String action, java.lang.Integer skipped)
public void onApplicationEvent(org.springframework.context.ApplicationEvent arg0)
onApplicationEvent
in interface org.springframework.context.ApplicationListener
onApplicationEvent
in class EventLogLoader
public boolean hasNext()
EventLogQueue.Entry
instances are available or tries
to load them if not. Conditions which will lead this to return false
include: "stop" being set, the batch size being met, the current
id in the database being equivalent to the newest event log.hasNext
in interface java.util.Iterator<EventLog>
hasNext
in class EventLogLoader
public EventLog next()
EventLogQueue.Data.next()
which could possibly be
null.next
in interface java.util.Iterator<EventLog>
next
in class EventLogLoader
protected EventLog query()
query
in class PersistentEventLogLoader
public long more()
EventLogQueue
will intend to use much larger batch
sizes, and so further loops should likely not be attempted.more
in class PersistentEventLogLoader
public void initialize()
initialize
in class PersistentEventLogLoader
public boolean addEventLog(java.lang.Class<? extends IObject> cls, long id)
addEventLog
in class EventLogLoader
Version: 5.4.4-ice35-b82
Copyright © 2018 The University of Dundee & Open Microscopy Environment. All Rights Reserved.