Esempio n. 1
0
  public void deliver() {
    String url = Configuration.getEndpointUrl();
    RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);

    List<PerformanceTiming> timings = deliveryQueue.popTimings();
    List<IncidentReport> incidents = deliveryQueue.popIncidents();

    ResultInjector injector = new RequestBodyInjector();
    HeaderInjector.Result result = injector.inject(builder, timings, incidents);

    if (result.shouldSend()) {
      MeasurementRequestCallback callback = new MeasurementRequestCallback(timings, incidents);
      builder.setCallback(callback);
      try {
        builder.send();
      } catch (RequestException e) {
        deliveryQueue.pushTiming(timings);
        deliveryQueue.pushIncident(incidents);
        // TODO Consider lost piggybacked timings as well
      }
    }
  }
Esempio n. 2
0
    public void onError(Request request, Throwable exception) {
      DeliveryQueue deliveryQueue = DeliveryQueue.instance();

      deliveryQueue.pushTiming(timings);
      deliveryQueue.pushIncident(incidents);
    }
Esempio n. 3
0
 public StandaloneDelivery() {
   deliveryQueue = DeliveryQueue.instance();
 }