MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / sendStatusAndClose

Method sendStatusAndClose

src/tsd/RpcHandler.java:312–318  ·  view source on GitHub ↗

Helper method for sending a status-only HTTP response. This is used in cases where #createQueryInstance(TSDB, HttpRequest, Channel) failed to determine a query and we still want to return an error status to the client.

(final Channel chan, final HttpResponseStatus status)

Source from the content-addressed store, hash-verified

310 * and we still want to return an error status to the client.
311 */
312 private void sendStatusAndClose(final Channel chan, final HttpResponseStatus status) {
313 if (chan.isConnected()) {
314 final DefaultHttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status);
315 final ChannelFuture future = chan.write(response);
316 future.addListener(ChannelFutureListener.CLOSE);
317 }
318 }
319
320 /**
321 * Collects the stats and metrics tracked by this instance.

Callers 1

handleHttpQueryMethod · 0.95

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected