public abstract class ResponseContext extends Object
QueryRunners.
The context is also transferred between Druid nodes with all the data it contains.
The response context consists of a set of key/value pairs. Keys are those defined in
the Keys registry. Keys are indexed by key instance, not by name. The
key defines the type of the associated value, including logic to merge values and
to deserialize JSON values for that key.
| Modifier and Type | Class and Description |
|---|---|
static class |
ResponseContext.AbstractKey
Abstract key class which provides most functionality except the
type-specific merge logic.
|
static class |
ResponseContext.BooleanKey
Boolean valued attribute with the semantics that once the flag is
set true, it stays true.
|
static class |
ResponseContext.CounterKey
Long valued attribute that holds the accumulation of values assigned.
|
static interface |
ResponseContext.Key
The base interface of a response context key.
|
static class |
ResponseContext.Keys
Global registry of response context keys.
|
static class |
ResponseContext.LongKey
Long valued attribute that holds the latest value assigned.
|
static class |
ResponseContext.SerializationResult
Serialization result of
ResponseContext. |
static class |
ResponseContext.StringKey
String valued attribute that holds the latest value assigned.
|
| Constructor and Description |
|---|
ResponseContext() |
| Modifier and Type | Method and Description |
|---|---|
Object |
add(ResponseContext.Key key,
Object value)
Adds (merges) a new value associated with a key to an old value.
|
void |
addCpuNanos(long ns) |
void |
addMissingSegments(List<SegmentDescriptor> descriptors) |
void |
addRemainingResponse(String id,
int count) |
void |
addRowScanCount(long count) |
static ResponseContext |
createEmpty()
Create an empty DefaultResponseContext instance
|
static ResponseContext |
deserialize(String responseContext,
com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Deserializes a string into
ResponseContext using given ObjectMapper. |
Object |
get(ResponseContext.Key key) |
Long |
getCpuNanos() |
protected abstract Map<ResponseContext.Key,Object> |
getDelegate() |
String |
getEntityTag() |
List<SegmentDescriptor> |
getMissingSegments() |
ConcurrentHashMap<String,Integer> |
getRemainingResponses() |
Long |
getRowScanCount() |
Long |
getTimeoutTime() |
AtomicLong |
getTotalBytes() |
List<org.joda.time.Interval> |
getUncoveredIntervals() |
void |
initialize()
Initialize fields for a query context.
|
void |
initializeMissingSegments() |
void |
initializeRemainingResponses() |
void |
initializeRowScanCount() |
void |
merge(ResponseContext responseContext)
Merges a response context into the current.
|
Object |
put(ResponseContext.Key key,
Object value)
Associates the specified object with the specified extension key.
|
void |
putEntityTag(String eTag) |
void |
putQueryFailDeadlineMs(long deadlineMs) |
void |
putTimeoutTime(long time) |
void |
putUncoveredIntervals(List<org.joda.time.Interval> intervals,
boolean overflowed) |
Object |
remove(ResponseContext.Key key) |
ResponseContext.SerializationResult |
serializeWith(com.fasterxml.jackson.databind.ObjectMapper objectMapper,
int maxCharsNumber)
Serializes the context given that the resulting string length is less than the provided limit.
|
Map<String,Object> |
toMap() |
protected abstract Map<ResponseContext.Key,Object> getDelegate()
public static ResponseContext createEmpty()
public void initialize()
public void initializeRemainingResponses()
public void initializeMissingSegments()
public void initializeRowScanCount()
public static ResponseContext deserialize(String responseContext, com.fasterxml.jackson.databind.ObjectMapper objectMapper) throws IOException
ResponseContext using given ObjectMapper.IllegalStateException - if one of the deserialized map keys has not been registered.IOExceptionpublic Object put(ResponseContext.Key key, Object value)
IllegalStateException - if the key has not been registered.public void putUncoveredIntervals(List<org.joda.time.Interval> intervals, boolean overflowed)
public void putEntityTag(String eTag)
public void putTimeoutTime(long time)
public void putQueryFailDeadlineMs(long deadlineMs)
public Object get(ResponseContext.Key key)
public ConcurrentHashMap<String,Integer> getRemainingResponses()
public List<org.joda.time.Interval> getUncoveredIntervals()
public List<SegmentDescriptor> getMissingSegments()
public String getEntityTag()
public AtomicLong getTotalBytes()
public Long getTimeoutTime()
public Long getRowScanCount()
public Long getCpuNanos()
public Object remove(ResponseContext.Key key)
public Object add(ResponseContext.Key key, Object value)
IllegalStateException - if the key has not been registered.public void addRemainingResponse(String id, int count)
public void addMissingSegments(List<SegmentDescriptor> descriptors)
public void addRowScanCount(long count)
public void addCpuNanos(long ns)
public void merge(ResponseContext responseContext)
IllegalStateException - If a key of the responseContext has not been registered.public ResponseContext.SerializationResult serializeWith(com.fasterxml.jackson.databind.ObjectMapper objectMapper, int maxCharsNumber) throws com.fasterxml.jackson.core.JsonProcessingException
ResponseContext.com.fasterxml.jackson.core.JsonProcessingExceptionCopyright © 2011–2022 The Apache Software Foundation. All rights reserved.