<commit_before>/*
 * Copyright (c) 2013 Spotify AB
 */

package com.spotify.apollo.request;

import com.spotify.apollo.Response;

import okio.ByteString;

class TrackedOngoingRequestImpl
    extends ForwardingOngoingRequest
    implements TrackedOngoingRequest {

  private final RequestTracker requestTracker;

  TrackedOngoingRequestImpl(
      OngoingRequest ongoingRequest,
      RequestTracker requestTracker) {
    super(ongoingRequest);
    this.requestTracker = requestTracker;

    requestTracker.register(this);
  }

  @Override
  public void reply(Response<ByteString> message) {
    doReply(message);
  }

  @Override
  public void drop() {
    final boolean removed = requestTracker.remove(this);
    if (removed) {
      super.drop();
    }
  }

  @Override
  public void incrementDownstreamRequests() {
  }

  private boolean doReply(Response<ByteString> message) {
    final boolean removed = requestTracker.remove(this);
    if (removed) {
      super.reply(message);
    }
    // TODO: how to log this?
//    else {
//      logRequest("DROPPED");
//    }
    return removed;
  }
}<commit_msg>remove comment about logging dropped requests<commit_after>/*
 * Copyright (c) 2013 Spotify AB
 */

package com.spotify.apollo.request;

import com.spotify.apollo.Response;

import okio.ByteString;

class TrackedOngoingRequestImpl
    extends ForwardingOngoingRequest
    implements TrackedOngoingRequest {

  private final RequestTracker requestTracker;

  TrackedOngoingRequestImpl(
      OngoingRequest ongoingRequest,
      RequestTracker requestTracker) {
    super(ongoingRequest);
    this.requestTracker = requestTracker;

    requestTracker.register(this);
  }

  @Override
  public void reply(Response<ByteString> message) {
    doReply(message);
  }

  @Override
  public void drop() {
    final boolean removed = requestTracker.remove(this);
    if (removed) {
      super.drop();
    }
  }

  @Override
  public void incrementDownstreamRequests() {
  }

  private boolean doReply(Response<ByteString> message) {
    final boolean removed = requestTracker.remove(this);
    if (removed) {
      super.reply(message);
    }

    return removed;
  }
}
{'fraction_non_alphanumeric': 0.0916628281897743, 'fraction_numerical': 0.0036849378166743437, 'mean_word_length': 3.5534591194968552, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4674187', 'n_tokens_mistral': 661, 'n_tokens_neox': 643, 'n_words': 142}