@Test(expected = NullPointerException.class) public void testUpdateWithNull() { WindowedMapGauge<Long> gauge = new WindowedMapGauge<>("wtf", 60000L, Long::max); gauge.update(null, 10L); }
public void update(String src, V val){ if (src == null) { throw new NullPointerException("Null source"); } Windows newWindows = getWindowStartTimes(clock.currentTimeMillis()); if (!newWindows.equals(windows)) { prevWindowMap = newWindows.prevStartMs == windows.activeStartMs? curWindowMap : new HashMap<>(); curWindowMap = new HashMap<>(); windows = newWindows; } curWindowMap.merge(src, val, mergeFunc); }
WindowedMapGauge extends Gauge<Map<String,Object>> { public void update(String src, V val){ if (src == null) { throw new NullPointerException("Null source"); } Windows newWindows = getWindowStartTimes(clock.currentTimeMillis()); if (!newWindows.equals(windows)) { prevWindowMap = newWindows.prevStartMs == windows.activeStartMs? curWindowMap : new HashMap<>(); curWindowMap = new HashMap<>(); windows = newWindows; } curWindowMap.merge(src, val, mergeFunc); } }
WindowedMapGauge extends Gauge<Map<String,Object>> { public void update(String src, V val){ if (src == null) { throw new NullPointerException("Null source"); } Windows newWindows = getWindowStartTimes(clock.currentTimeMillis()); if (!newWindows.equals(windows)) { prevWindowMap = newWindows.prevStartMs == windows.activeStartMs? curWindowMap : new HashMap<>(); curWindowMap = new HashMap<>(); windows = newWindows; } curWindowMap.merge(src, val, mergeFunc); } WindowedMapGauge(String name, long windowDurationMs, BiFunction<V,V,V> mergeFunc);  WindowedMapGauge(String name, long windowDurationMs, BiFunction<V,V,V> mergeFunc, Clock clock); }
WindowedMapGauge extends Gauge<Map<String,Object>> { public void update(String src, V val){ if (src == null) { throw new NullPointerException("Null source"); } Windows newWindows = getWindowStartTimes(clock.currentTimeMillis()); if (!newWindows.equals(windows)) { prevWindowMap = newWindows.prevStartMs == windows.activeStartMs? curWindowMap : new HashMap<>(); curWindowMap = new HashMap<>(); windows = newWindows; } curWindowMap.merge(src, val, mergeFunc); } WindowedMapGauge(String name, long windowDurationMs, BiFunction<V,V,V> mergeFunc);  WindowedMapGauge(String name, long windowDurationMs, BiFunction<V,V,V> mergeFunc, Clock clock); void update(String src, V val); @Override Map<String,Object> getValue(); Map<String,V> getSnapshot(); Windows getWindowStartTimes(long tsMs); }
WindowedMapGauge extends Gauge<Map<String,Object>> { public void update(String src, V val){ if (src == null) { throw new NullPointerException("Null source"); } Windows newWindows = getWindowStartTimes(clock.currentTimeMillis()); if (!newWindows.equals(windows)) { prevWindowMap = newWindows.prevStartMs == windows.activeStartMs? curWindowMap : new HashMap<>(); curWindowMap = new HashMap<>(); windows = newWindows; } curWindowMap.merge(src, val, mergeFunc); } WindowedMapGauge(String name, long windowDurationMs, BiFunction<V,V,V> mergeFunc);  WindowedMapGauge(String name, long windowDurationMs, BiFunction<V,V,V> mergeFunc, Clock clock); void update(String src, V val); @Override Map<String,Object> getValue(); Map<String,V> getSnapshot(); Windows getWindowStartTimes(long tsMs);  }