public class BatchWriter extends SingleThreadedWriter implements Neo4jWriter
SingleThreadedWriter that writes tasks in batches. This is more performant but dangerous,
since a single task's failure can roll back the whole batch. This is here for experiments, not for production.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BATCH_SIZE |
databaseDEFAULT_QUEUE_CAPACITY, queue| Constructor and Description |
|---|
BatchWriter(org.neo4j.graphdb.GraphDatabaseService database)
Construct a new writer with a default queue capacity of 10,000 and a batch size of 1,000.
|
BatchWriter(org.neo4j.graphdb.GraphDatabaseService database,
int queueCapacity,
int batchSize)
Construct a new writer.
|
| Modifier and Type | Method and Description |
|---|---|
protected <T> RunnableFuture<T> |
createTask(Callable<T> task)
Create a runnable future from the given task.
|
protected void |
processInput(RunnableFuture<?> input)
Perform the processing of the given
RunnableFuture. |
protected void |
runOneIteration() |
block, offer, start, stop, write, write, writeequals, hashCode, logEmptyQueue, loggingFrequencyMs, offer, scheduler, shutDownaddListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, startUp, state, stopAsync, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitwrite, write, writepublic static final int DEFAULT_BATCH_SIZE
public BatchWriter(org.neo4j.graphdb.GraphDatabaseService database)
database - to write to.public BatchWriter(org.neo4j.graphdb.GraphDatabaseService database,
int queueCapacity,
int batchSize)
database - to write to.queueCapacity - capacity of the queue.batchSize - batch size.protected <T> RunnableFuture<T> createTask(Callable<T> task)
createTask in class SingleThreadedWritertask - task.protected final void runOneIteration()
throws Exception
runOneIteration in class com.google.common.util.concurrent.AbstractScheduledServiceExceptionprotected void processInput(RunnableFuture<?> input)
RunnableFuture.
Can be overridden to add extra logging, timing, etc.input - to process.Copyright © 2013-2016–2020 Graph Aware Limited. All rights reserved.