(final Timeout timeout)
| 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 |
nothing calls this directly
no test coverage detected