public class ElasticsearchWorkProcessor extends Object implements AutoCloseable
ElasticsearchWorks against the Elasticsearch server.
When processing multiple requests, bulk requests will be formed and executed as far as possible.
Requests can be processed synchronously or asynchronously. In the latter case, incoming requests are added to a queue
via AsyncBackendRequestProcessor from where a worker runnable will process them in bulks.
| Constructor and Description |
|---|
ElasticsearchWorkProcessor(BuildContext context,
ElasticsearchClient client,
GsonProvider gsonProvider,
ElasticsearchWorkFactory workFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
awaitAsyncProcessingCompletion()
Blocks until the queue of requests scheduled for asynchronous processing has been fully processed.
|
void |
close() |
void |
executeAsync(ElasticsearchWork<?> work)
Execute a single work asynchronously.
|
void |
executeAsync(List<ElasticsearchWork<?>> works)
Execute a set of works asynchronously.
|
void |
executeSyncSafe(Iterable<ElasticsearchWork<?>> works)
Execute a set of works synchronously.
|
<T> T |
executeSyncUnsafe(ElasticsearchWork<T> work)
Execute a single work synchronously,
potentially throwing exceptions (the error handler isn't used).
|
public ElasticsearchWorkProcessor(BuildContext context, ElasticsearchClient client, GsonProvider gsonProvider, ElasticsearchWorkFactory workFactory)
public void close()
close in interface AutoCloseablepublic <T> T executeSyncUnsafe(ElasticsearchWork<T> work)
work - The work to be executed.public void executeSyncSafe(Iterable<ElasticsearchWork<?>> works)
Works submitted in the same list will be executed in the given order.
If any work throws an exception, this exception will be passed
to the error handler with an ErrorContext spanning at least the given works,
and the remaining works will not be executed.
works - The works to be executed.public void executeAsync(ElasticsearchWork<?> work)
If the work throws an exception, this exception will be passed
to the error handler with an ErrorContext spanning at least this work.
work - The work to be executed.public void executeAsync(List<ElasticsearchWork<?>> works)
Works submitted in the same list will be executed in the given order.
If any work throws an exception, this exception will be passed
to the error handler with an ErrorContext spanning at least the given works,
and the remaining works will not be executed.
works - The works to be executed.public void awaitAsyncProcessingCompletion()
Copyright © 2006–2017 Hibernate. All rights reserved.