public abstract class Loader extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Collection<Var> |
batch |
protected int |
batchSize |
protected AtomicInteger |
enqueuedJobs |
protected AtomicInteger |
errorJobs |
protected AtomicInteger |
finishedJobs |
protected AtomicInteger |
loadingJobs |
protected int |
threadsNumber |
| Constructor and Description |
|---|
Loader() |
| Modifier and Type | Method and Description |
|---|---|
void |
addToQueue(Collection<? extends Var> vars)
Add multiple vars to the queue.
|
void |
addToQueue(String vars)
Add the given query to the queue to load
|
void |
addToQueue(Var var)
Add a single var to the queue
|
void |
flush()
Load any remaining batches in the queue.
|
int |
getBatchSize() |
void |
markAsError(String transaction) |
void |
markAsFinished(String transaction) |
void |
markAsLoading(String transaction) |
void |
markAsQueued(String transaction) |
void |
printLoaderState()
Method that logs the current state of loading transactions
|
void |
setBatchSize(int size)
Set the size of the each transaction in terms of number of vars.
|
void |
setThreadsNumber(int number) |
protected abstract void |
submitBatch(Collection<Var> batch)
Method to load data into the graph.
|
abstract void |
waitToFinish()
Wait for all loading to terminate.
|
protected AtomicInteger enqueuedJobs
protected AtomicInteger loadingJobs
protected AtomicInteger finishedJobs
protected AtomicInteger errorJobs
protected Collection<Var> batch
protected int batchSize
protected int threadsNumber
protected abstract void submitBatch(Collection<Var> batch)
public abstract void waitToFinish()
public void addToQueue(Var var)
var - to be loadedpublic void addToQueue(String vars)
vars - to be loadedpublic void addToQueue(Collection<? extends Var> vars)
vars - to be loadedpublic void setBatchSize(int size)
size - number of vars in each transactionpublic int getBatchSize()
public void setThreadsNumber(int number)
public void flush()
public void printLoaderState()
public void markAsQueued(String transaction)
public void markAsLoading(String transaction)
public void markAsFinished(String transaction)
public void markAsError(String transaction)
Copyright © 2016. All rights reserved.