public abstract class AbstractBatch extends TimerTask
onFlushFailure(BatchEntry[]).| Modifier and Type | Field and Description |
|---|---|
protected int |
batch
The batch at the present moment.
|
protected int |
batchSize
The batchSize.
|
protected long |
batchTimeout
The batch timeout.
|
protected LinkedList<BatchEntry> |
buffer
EntityEntry buffer.
|
protected DatabaseEngine |
de
The database engine.
|
protected static org.slf4j.Marker |
dev
The dev Marker.
|
protected long |
lastFlush
Timestamp of the last flush.
|
protected org.slf4j.Logger |
logger
The logger.
|
protected static int |
salt
Salt to avoid erroneous flushes.
|
protected Timer |
timer
The Timer that runs this task.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractBatch(DatabaseEngine de,
int batchSize,
long batchTimeout)
Creates a new instance of
AbstractBatch. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(BatchEntry batchEntry)
Adds the fields to the batch.
|
void |
add(String entityName,
EntityEntry ee)
Adds the fields to the batch.
|
void |
destroy()
Destroys this batch.
|
void |
finalize() |
void |
flush()
Flushes the pending batches.
|
void |
onFlushFailure(BatchEntry[] entries)
Notifies about the pending entries on flush failure.
|
void |
run() |
protected void |
start()
Starts the timer task.
|
cancel, scheduledExecutionTimeprotected final org.slf4j.Logger logger
protected static final org.slf4j.Marker dev
protected static final int salt
protected final DatabaseEngine de
protected final Timer timer
protected final int batchSize
protected final long batchTimeout
protected int batch
protected long lastFlush
protected LinkedList<BatchEntry> buffer
protected AbstractBatch(DatabaseEngine de, int batchSize, long batchTimeout)
AbstractBatch.de - The database engine.batchSize - The batch size.batchTimeout - The batch timeout.protected void start()
public void destroy()
public void add(BatchEntry batchEntry) throws DatabaseEngineException
batchEntry - The batch entry.DatabaseEngineException - If an error with the database occurs.public void add(String entityName, EntityEntry ee) throws DatabaseEngineException
entityName - The table name.ee - The entity entry.DatabaseEngineException - If an error with the database occurs.public void flush()
public void onFlushFailure(BatchEntry[] entries)
entries - The entries that are pending to be persisted.Copyright © 2013. All Rights Reserved.