Class AbstractBatchCommitter<T extends BaseBatchCommitterConfig>
java.lang.Object
com.norconex.committer.core.AbstractCommitter<T>
com.norconex.committer.core.batch.AbstractBatchCommitter<T>
- Type Parameters:
T- Committer configuration type
- All Implemented Interfaces:
BatchConsumer,Committer,Configurable<T>,AutoCloseable
- Direct Known Subclasses:
AmazonCloudSearchCommitter,ApacheKafkaCommitter,AzureSearchCommitter,ElasticsearchCommitter,GoogleCloudSearchCommitter,IdolCommitter,Neo4jCommitter,SolrCommitter,SqlCommitter
public abstract class AbstractBatchCommitter<T extends BaseBatchCommitterConfig>
extends AbstractCommitter<T>
implements BatchConsumer
A base implementation for doing batch commits. Uses an internal queue for storing update/addition requests and deletion requests. It sends the queued data to the remote target every time a given queue threshold has been reached. Unless otherwise stated, both additions and deletions count towards that threshold.
This class also provides batch-related events:
COMMITTER_BATCH_BEGIN,
COMMITTER_BATCH_END, and
COMMITTER_BATCH_ERROR.
The default queue is FsQueue (file-system queue).
-
Field Summary
Fields inherited from interface com.norconex.commons.lang.config.Configurable
PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected voidSubclasses can perform additional closing logic by overriding this method.protected abstract voidCommits the supplied batch.voidprotected voiddoClean()protected voiddoClose()Subclasses can perform additional closing logic by overriding this method.protected voiddoDelete(DeleteRequest deleteRequest) protected final voiddoInit()Subclasses can perform additional initialization by overriding this method.protected voiddoUpsert(UpsertRequest upsertRequest) booleanprotected CommitterQueueinthashCode()protected voidSubclasses can perform additional initialization by overriding this method.toString()Methods inherited from class com.norconex.committer.core.AbstractCommitter
accept, applyFieldMappings, clean, close, delete, fireDebug, fireDebug, fireError, fireError, fireInfo, fireInfo, getCommitterContext, init, upsertMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.norconex.commons.lang.config.Configurable
getConfiguration
-
Constructor Details
-
AbstractBatchCommitter
public AbstractBatchCommitter()
-
-
Method Details
-
doInit
Description copied from class:AbstractCommitterSubclasses can perform additional initialization by overriding this method. Default implementation does nothing. TheCommitterContextwill be initialized when invokingAbstractCommitter.getCommitterContext()- Specified by:
doInitin classAbstractCommitter<T extends BaseBatchCommitterConfig>- Throws:
CommitterException- error initializing
-
doUpsert
- Specified by:
doUpsertin classAbstractCommitter<T extends BaseBatchCommitterConfig>- Throws:
CommitterException
-
doDelete
- Specified by:
doDeletein classAbstractCommitter<T extends BaseBatchCommitterConfig>- Throws:
CommitterException
-
doClose
Description copied from class:AbstractCommitterSubclasses can perform additional closing logic by overriding this method. Default implementation does nothing.- Specified by:
doClosein classAbstractCommitter<T extends BaseBatchCommitterConfig>- Throws:
CommitterException- error closing committer
-
doClean
- Specified by:
doCleanin classAbstractCommitter<T extends BaseBatchCommitterConfig>- Throws:
CommitterException
-
consume
- Specified by:
consumein interfaceBatchConsumer- Throws:
CommitterException
-
getInitializedQueue
-
initBatchCommitter
Subclasses can perform additional initialization by overriding this method. Default implementation does nothing. The committer context and committer queue will be already initialized when invokingAbstractCommitter.getCommitterContext()andgetInitializedQueue(), respectively.- Throws:
CommitterException- error initializing
-
commitBatch
Commits the supplied batch.- Parameters:
it- the batch to commit- Throws:
CommitterException- could not commit the batch
-
closeBatchCommitter
Subclasses can perform additional closing logic by overriding this method. Default implementation does nothing.- Throws:
CommitterException- error closing committer
-
equals
- Overrides:
equalsin classAbstractCommitter<T extends BaseBatchCommitterConfig>
-
canEqual
- Overrides:
canEqualin classAbstractCommitter<T extends BaseBatchCommitterConfig>
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractCommitter<T extends BaseBatchCommitterConfig>
-
toString
- Overrides:
toStringin classAbstractCommitter<T extends BaseBatchCommitterConfig>
-