public static void removeSampler(Sampler sampler) {
    synchronized (samplerLock) {
      Sampler[] samplers = additionalSamplers;
      int samplerCount = samplers.length;
      for (Sampler s : samplers) {
        if (s.equals(sampler)) {
          samplerCount--;
        }
      }
      Sampler[] newSamplers = new Sampler[samplerCount];
      int i = 0;
      for (Sampler s : samplers) {
        if (!s.equals(sampler)) {
          newSamplers[i++] = s;
        }
      }
      additionalSamplers = newSamplers;
    }
  }
Removes the given {@link Sampler}.

@param sampler The sampler to remove.
src/main/java/com/google/monitoring/runtime/instrumentation/AllocationRecorder.java