(final ArrayList<Boolean> results)
| 618 | } |
| 619 | |
| 620 | @Override |
| 621 | public Object call(final ArrayList<Boolean> results) { |
| 622 | if (sending_response.get()) { |
| 623 | if (LOG.isDebugEnabled()) { |
| 624 | LOG.debug("Put data point call " + query + " was marked as timedout"); |
| 625 | } |
| 626 | return null; |
| 627 | } else { |
| 628 | sending_response.set(true); |
| 629 | if (timeout != null) { |
| 630 | timeout.cancel(); |
| 631 | } |
| 632 | } |
| 633 | int good_writes = 0; |
| 634 | int failed_writes = 0; |
| 635 | for (final boolean result : results) { |
| 636 | if (result) { |
| 637 | ++good_writes; |
| 638 | } else { |
| 639 | ++failed_writes; |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | final int failures = dps.size() - queued; |
| 644 | if (!show_summary && !show_details) { |
| 645 | if (failures + failed_writes > 0) { |
| 646 | query.sendReply(HttpResponseStatus.BAD_REQUEST, |
| 647 | query.serializer().formatErrorV1( |
| 648 | new BadRequestException(HttpResponseStatus.BAD_REQUEST, |
| 649 | "One or more data points had errors", |
| 650 | "Please see the TSD logs or append \"details\" to the put request"))); |
| 651 | } else { |
| 652 | query.sendReply(HttpResponseStatus.NO_CONTENT, "".getBytes()); |
| 653 | } |
| 654 | } else { |
| 655 | final HashMap<String, Object> summary = new HashMap<String, Object>(); |
| 656 | if (sync_timeout > 0) { |
| 657 | summary.put("timeouts", 0); |
| 658 | } |
| 659 | summary.put("success", results.isEmpty() ? queued : good_writes); |
| 660 | summary.put("failed", failures + failed_writes); |
| 661 | if (show_details) { |
| 662 | summary.put("errors", details); |
| 663 | } |
| 664 | |
| 665 | if (failures > 0) { |
| 666 | query.sendReply(HttpResponseStatus.BAD_REQUEST, |
| 667 | query.serializer().formatPutV1(summary)); |
| 668 | } else { |
| 669 | query.sendReply(query.serializer().formatPutV1(summary)); |
| 670 | } |
| 671 | } |
| 672 | |
| 673 | return null; |
| 674 | } |
| 675 | @Override |
| 676 | public String toString() { |
| 677 | return "put data point serialization callback"; |
nothing calls this directly
no test coverage detected