public class HeapBufferedAsyncResponseConsumer
extends org.elasticsearch.client.http.nio.protocol.AbstractAsyncResponseConsumer<org.elasticsearch.client.http.HttpResponse>
HttpAsyncResponseConsumer. Buffers the whole
response content in heap memory, meaning that the size of the buffer is equal to the content-length of the response.
Limits the size of responses that can be read based on a configurable argument. Throws an exception in case the entity is longer
than the configured buffer limit.| Constructor and Description |
|---|
HeapBufferedAsyncResponseConsumer(int bufferLimit)
Creates a new instance of this consumer with the provided buffer limit
|
| Modifier and Type | Method and Description |
|---|---|
protected org.elasticsearch.client.http.HttpResponse |
buildResult(org.elasticsearch.client.http.protocol.HttpContext context) |
int |
getBufferLimit()
Get the limit of the buffer.
|
protected org.elasticsearch.client.http.nio.util.ByteBufferAllocator |
getByteBufferAllocator()
Returns the instance of
ByteBufferAllocator to use for content buffering. |
protected void |
onContentReceived(org.elasticsearch.client.http.nio.ContentDecoder decoder,
org.elasticsearch.client.http.nio.IOControl ioctrl) |
protected void |
onEntityEnclosed(org.elasticsearch.client.http.HttpEntity entity,
org.elasticsearch.client.http.entity.ContentType contentType) |
protected void |
onResponseReceived(org.elasticsearch.client.http.HttpResponse response) |
protected void |
releaseResources() |
public HeapBufferedAsyncResponseConsumer(int bufferLimit)
public int getBufferLimit()
protected void onResponseReceived(org.elasticsearch.client.http.HttpResponse response)
throws org.elasticsearch.client.http.HttpException,
java.io.IOException
onResponseReceived in class org.elasticsearch.client.http.nio.protocol.AbstractAsyncResponseConsumer<org.elasticsearch.client.http.HttpResponse>org.elasticsearch.client.http.HttpExceptionjava.io.IOExceptionprotected void onEntityEnclosed(org.elasticsearch.client.http.HttpEntity entity,
org.elasticsearch.client.http.entity.ContentType contentType)
throws java.io.IOException
onEntityEnclosed in class org.elasticsearch.client.http.nio.protocol.AbstractAsyncResponseConsumer<org.elasticsearch.client.http.HttpResponse>java.io.IOExceptionprotected org.elasticsearch.client.http.nio.util.ByteBufferAllocator getByteBufferAllocator()
ByteBufferAllocator to use for content buffering.
Allows to plug in any ByteBufferAllocator implementation.protected void onContentReceived(org.elasticsearch.client.http.nio.ContentDecoder decoder,
org.elasticsearch.client.http.nio.IOControl ioctrl)
throws java.io.IOException
onContentReceived in class org.elasticsearch.client.http.nio.protocol.AbstractAsyncResponseConsumer<org.elasticsearch.client.http.HttpResponse>java.io.IOExceptionprotected org.elasticsearch.client.http.HttpResponse buildResult(org.elasticsearch.client.http.protocol.HttpContext context)
throws java.lang.Exception
buildResult in class org.elasticsearch.client.http.nio.protocol.AbstractAsyncResponseConsumer<org.elasticsearch.client.http.HttpResponse>java.lang.Exceptionprotected void releaseResources()
releaseResources in class org.elasticsearch.client.http.nio.protocol.AbstractAsyncResponseConsumer<org.elasticsearch.client.http.HttpResponse>