@Override public void add(double x, int w) { add(x, w, (List<Double>) null); }
@Override public void add(double x, int w) { add(x, w, (List<Double>) null); }
@Override void add(double x, int w, Centroid base) { add(x, w, base.data()); }
@Override void add(double x, int w, Centroid base) { add(x, w, base.data()); }
/** * Update {@code AgentDigest} in the cache with another {@code AgentDigest}. * * @param key histogram key * @param value {@code AgentDigest} to be merged */ public void put(HistogramKey key, @Nonnull AgentDigest value) { cache.asMap().compute(key, (k, v) -> { if (v == null) { keyIndex.put(key, value.getDispatchTimeMillis()); return value; } else { keyIndex.compute(key, (k1, v1) -> ( v1 != null && v1 < v.getDispatchTimeMillis() ? v1 : v.getDispatchTimeMillis())); v.add(value); return v; } }); }
/** * Update {@code AgentDigest} in the cache with another {@code AgentDigest}. * * @param key histogram key * @param value {@code AgentDigest} to be merged */ public void put(HistogramKey key, @Nonnull AgentDigest value) { cache.asMap().compute(key, (k, v) -> { if (v == null) { keyIndex.put(key, value.getDispatchTimeMillis()); return value; } else { keyIndex.compute(key, (k1, v1) -> ( v1 != null && v1 < v.getDispatchTimeMillis() ? v1 : v.getDispatchTimeMillis())); v.add(value); return v; } }); }
/** * Update {@code AgentDigest} in the cache with a double value. If such {@code AgentDigest} does not exist for * the specified key, it will be created with the specified compression and ttlMillis settings. * * @param key histogram key * @param value value to be merged into the {@code AgentDigest} * @param compression default compression level for new bins * @param ttlMillis default time-to-dispatch for new bins */ public void put(HistogramKey key, double value, short compression, long ttlMillis) { cache.asMap().compute(key, (k, v) -> { if (v == null) { binCreatedCounter.inc(); AgentDigest t = new AgentDigest(compression, System.currentTimeMillis() + ttlMillis); keyIndex.compute(key, (k1, v1) -> ( v1 != null && v1 < t.getDispatchTimeMillis() ? v1 : t.getDispatchTimeMillis() )); t.add(value); return t; } else { keyIndex.compute(key, (k1, v1) -> ( v1 != null && v1 < v.getDispatchTimeMillis() ? v1 : v.getDispatchTimeMillis() )); v.add(value); return v; } }); }
/** * Update {@code AgentDigest} in the cache with a double value. If such {@code AgentDigest} does not exist for * the specified key, it will be created with the specified compression and ttlMillis settings. * * @param key histogram key * @param value value to be merged into the {@code AgentDigest} * @param compression default compression level for new bins * @param ttlMillis default time-to-dispatch for new bins */ public void put(HistogramKey key, double value, short compression, long ttlMillis) { cache.asMap().compute(key, (k, v) -> { if (v == null) { binCreatedCounter.inc(); AgentDigest t = new AgentDigest(compression, System.currentTimeMillis() + ttlMillis); keyIndex.compute(key, (k1, v1) -> ( v1 != null && v1 < t.getDispatchTimeMillis() ? v1 : t.getDispatchTimeMillis() )); t.add(value); return t; } else { keyIndex.compute(key, (k1, v1) -> ( v1 != null && v1 < v.getDispatchTimeMillis() ? v1 : v.getDispatchTimeMillis() )); v.add(value); return v; } }); }