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

Method run

src/tsd/PutDataPointRpc.java:554–604  ·  view source on GitHub ↗
(final Timeout timeout)

Source from the content-addressed store, hash-verified

552 this.queued = queued;
553 }
554 @Override
555 public void run(final Timeout timeout) throws Exception {
556 if (sending_response.get()) {
557 if (LOG.isDebugEnabled()) {
558 LOG.debug("Put data point call " + query +
559 " already responded successfully");
560 }
561 return;
562 } else {
563 sending_response.set(true);
564 }
565
566 // figure out how many writes are outstanding
567 int good_writes = 0;
568 int failed_writes = 0;
569 int timeouts = 0;
570 for (int i = 0; i < deferreds.size(); i++) {
571 try {
572 if (deferreds.get(i).join(1)) {
573 ++good_writes;
574 } else {
575 ++failed_writes;
576 }
577 } catch (TimeoutException te) {
578 if (show_details) {
579 details.add(getHttpDetails("Write timedout", dps.get(i)));
580 }
581 ++timeouts;
582 }
583 }
584 writes_timedout.addAndGet(timeouts);
585 final int failures = dps.size() - queued;
586 if (!show_summary && !show_details) {
587 query.sendReply(HttpResponseStatus.BAD_REQUEST, query.serializer().formatErrorV1(
588 new BadRequestException(HttpResponseStatus.BAD_REQUEST,
589 "The put call has timedout with " + good_writes + " successful writes, "
590 + failed_writes + " failed writes and " + timeouts + " timed out writes.",
591 "Please see the TSD logs or append \"details\" to the put request")));
592 } else {
593 final HashMap<String, Object> summary = new HashMap<String, Object>();
594 summary.put("success", good_writes);
595 summary.put("failed", failures + failed_writes);
596 summary.put("timeouts", timeouts);
597 if (show_details) {
598 summary.put("errors", details);
599 }
600
601 query.sendReply(HttpResponseStatus.BAD_REQUEST,
602 query.serializer().formatPutV1(summary));
603 }
604 }
605 }
606
607 // now after everything has been sent we can schedule a timeout if so

Callers

nothing calls this directly

Calls 10

setMethod · 0.80
sendReplyMethod · 0.80
formatErrorV1Method · 0.80
serializerMethod · 0.80
putMethod · 0.80
sizeMethod · 0.65
getMethod · 0.45
addMethod · 0.45
getHttpDetailsMethod · 0.45
formatPutV1Method · 0.45

Tested by

no test coverage detected