public class JresBulkRequestor
extends java.lang.Object
implements java.lang.Runnable, java.io.Closeable
JresBulkable operations and submits them in batch according to constructor parameters.
Be sure to start() this requestor. This requestor can be properly shutdown if such behavior is desired
through close(). Allow ample time for the buffers to flush and submit to ElasticSearch (see
CLOSING_LENIENCY_SECONDS).
| Modifier and Type | Field and Description |
|---|---|
static int |
CLOSING_LENIENCY_SECONDS
Amount of time
close() should wait for buffers to flush and submit before excepting. |
static int |
POLLING_LENIENCY_SECONDS
Polling lenience, how long in seconds each poll to the transfer queue is willing to wait.
|
| Constructor and Description |
|---|
JresBulkRequestor(int batchSize,
int sleepIntervalMs,
int numThreads,
com.blacklocus.jres.Jres jres)
Create a JresBulkRequestor which does not default to any particular index nor type.
|
JresBulkRequestor(int batchSize,
int sleepIntervalMs,
int numThreads,
java.lang.String targetIndex,
com.blacklocus.jres.Jres jres)
Create a JresBulkRequestor defaulting to a particular index.
|
JresBulkRequestor(int batchSize,
int sleepIntervalMs,
int numThreads,
java.lang.String targetIndex,
java.lang.String targetType,
com.blacklocus.jres.Jres jres)
Create a JresBulkRequestor defaulting to a particular index.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Waits for the internal document indexing queue to empty.
|
java.util.concurrent.Future<?> |
offer(com.blacklocus.jres.request.JresBulkable bulkable,
long timeout,
java.util.concurrent.TimeUnit unit) |
java.util.concurrent.Future<?> |
put(com.blacklocus.jres.request.JresBulkable bulkable) |
void |
run() |
JresBulkRequestor |
start() |
public static final int POLLING_LENIENCY_SECONDS
public static final int CLOSING_LENIENCY_SECONDS
close() should wait for buffers to flush and submit before excepting.public JresBulkRequestor(int batchSize,
int sleepIntervalMs,
int numThreads,
com.blacklocus.jres.Jres jres)
Be sure to start() this requestor
public JresBulkRequestor(int batchSize,
int sleepIntervalMs,
int numThreads,
@Nullable
java.lang.String targetIndex,
com.blacklocus.jres.Jres jres)
Be sure to start() this requestor
public JresBulkRequestor(int batchSize,
int sleepIntervalMs,
int numThreads,
@Nullable
java.lang.String targetIndex,
@Nullable
java.lang.String targetType,
com.blacklocus.jres.Jres jres)
Be sure to start() this requestor
public JresBulkRequestor start()
public java.util.concurrent.Future<?> put(com.blacklocus.jres.request.JresBulkable bulkable)
Future.get() will except.public java.util.concurrent.Future<?> offer(com.blacklocus.jres.request.JresBulkable bulkable,
long timeout,
java.util.concurrent.TimeUnit unit)
Future.get() will except.
null if the offer failed to commit in the timeout allotted.public void run()
run in interface java.lang.Runnablepublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOException - particularly, if interrupted