public abstract class AbstractConsumer extends AbstractTaskRunner implements Consumer
Modifier and Type | Field and Description |
---|---|
protected Batch |
batch |
protected static long |
CHECK_INTERVAL |
protected com.codahale.metrics.Timer |
commitTimer |
protected com.codahale.metrics.Counter |
consumerCount |
protected com.codahale.metrics.Counter |
failCount |
protected long |
lastCheckTime |
protected long |
lastCount |
protected double |
lastImediatThroughput |
protected ImporterLogger |
log |
protected String |
originatingUsername |
protected com.codahale.metrics.Timer |
processTimer |
protected BlockingQueue<SourceNode> |
queue |
protected com.codahale.metrics.MetricRegistry |
registry |
protected boolean |
replayMode |
protected String |
repositoryName |
protected com.codahale.metrics.Counter |
retryCount |
protected DocumentRef |
rootRef |
protected long |
startTime |
protected String |
threadName |
canStop, completed, error, mustStop, nbProcessed, started
Constructor and Description |
---|
AbstractConsumer(ImporterLogger log,
DocumentModel root,
int batchSize,
BlockingQueue<SourceNode> queue) |
Modifier and Type | Method and Description |
---|---|
protected void |
commit(CoreSession session) |
protected void |
commitIfNeeded(CoreSession session) |
String |
getOriginatingUsername() |
protected void |
onSourceNodeException(SourceNode node,
Exception e)
Override if you want to do more that logging the error.
|
protected void |
onSourceNodeRollBack(SourceNode node)
Override if you want to do more that logging the error.
|
protected abstract void |
process(CoreSession session,
SourceNode bh) |
protected void |
rollbackAndReplayBatch(CoreSession session) |
void |
run() |
protected void |
runDrainer() |
protected void |
runImport() |
void |
setOriginatingUsername(String originatingUsername) |
canStop, getError, getNbProcessed, incrementProcessed, isCompleted, isTerminated, mustStop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getNbDocsCreated
canStop, getError, getNbProcessed, isCompleted, isTerminated, mustStop
protected final String repositoryName
protected final BlockingQueue<SourceNode> queue
protected final DocumentRef rootRef
protected long startTime
protected long lastCheckTime
protected long lastCount
protected static final long CHECK_INTERVAL
protected double lastImediatThroughput
protected String originatingUsername
protected ImporterLogger log
protected boolean replayMode
protected String threadName
protected final com.codahale.metrics.MetricRegistry registry
protected final com.codahale.metrics.Timer processTimer
protected final com.codahale.metrics.Timer commitTimer
protected final com.codahale.metrics.Counter retryCount
protected final com.codahale.metrics.Counter failCount
protected final com.codahale.metrics.Counter consumerCount
public AbstractConsumer(ImporterLogger log, DocumentModel root, int batchSize, BlockingQueue<SourceNode> queue)
protected void runDrainer()
protected void runImport()
protected abstract void process(CoreSession session, SourceNode bh) throws Exception
Exception
protected void commitIfNeeded(CoreSession session)
protected void commit(CoreSession session)
protected void rollbackAndReplayBatch(CoreSession session)
protected void onSourceNodeException(SourceNode node, Exception e)
node
- e
- protected void onSourceNodeRollBack(SourceNode node)
node
- public String getOriginatingUsername()
public void setOriginatingUsername(String originatingUsername)
Copyright © 2016 Nuxeo SA. All rights reserved.