target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testScheduledExecutorServiceCaptures() throws InterruptedException { ScheduledExecutorService e = Executors.newScheduledThreadPool(10); ScheduledExecutorService f = StateCapture.capturingDecorator(e); CapturedState mockCapturedState = mock(CapturedState.class); Runnable mockRunnable = mock(Runnable.cl... | public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } | StateCapture { public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } } | StateCapture { public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } private StateCapture(); } | StateCapture { public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } private StateCapture(); static Executor capturingDecorator(final Executor executor); static Ex... | StateCapture { public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } private StateCapture(); static Executor capturingDecorator(final Executor executor); static Ex... |
@Test public void benchmark() throws Exception { final long iterations = 1000000; long duration_StringFormat = run_benchmark(iterations, (a) -> String.format("%.6f", a)); NumberFormat javaFormatter = NumberFormat.getInstance(); javaFormatter.setMinimumFractionDigits(0); javaFormatter.setMaximumFractionDigits(6); javaFo... | public static void format(Appendable sb, double value) { try { format_exception(sb, value); } catch (IOException e) { throw new IllegalStateException("Appendable must not throw IOException", e); } } | DoubleFormat { public static void format(Appendable sb, double value) { try { format_exception(sb, value); } catch (IOException e) { throw new IllegalStateException("Appendable must not throw IOException", e); } } } | DoubleFormat { public static void format(Appendable sb, double value) { try { format_exception(sb, value); } catch (IOException e) { throw new IllegalStateException("Appendable must not throw IOException", e); } } private DoubleFormat(); } | DoubleFormat { public static void format(Appendable sb, double value) { try { format_exception(sb, value); } catch (IOException e) { throw new IllegalStateException("Appendable must not throw IOException", e); } } private DoubleFormat(); static void format(Appendable sb, double value); } | DoubleFormat { public static void format(Appendable sb, double value) { try { format_exception(sb, value); } catch (IOException e) { throw new IllegalStateException("Appendable must not throw IOException", e); } } private DoubleFormat(); static void format(Appendable sb, double value); } |
@Test public void currentContextIsPropagatedToTask() throws Exception { ThreadContext context = ThreadContext.emptyContext().with(KEY, "value"); try (ThreadContext.CloseableContext ignored = context.open()) { executor.execute(captureTask); } latch.await(); assertSame(context, contextCapture.get()); } | @Override public void execute(Runnable command) { executor.execute(ThreadContext.current().wrap(command)); } | ContextAwareExecutor implements Executor { @Override public void execute(Runnable command) { executor.execute(ThreadContext.current().wrap(command)); } } | ContextAwareExecutor implements Executor { @Override public void execute(Runnable command) { executor.execute(ThreadContext.current().wrap(command)); } ContextAwareExecutor(Executor executor); } | ContextAwareExecutor implements Executor { @Override public void execute(Runnable command) { executor.execute(ThreadContext.current().wrap(command)); } ContextAwareExecutor(Executor executor); @Override void execute(Runnable command); } | ContextAwareExecutor implements Executor { @Override public void execute(Runnable command) { executor.execute(ThreadContext.current().wrap(command)); } ContextAwareExecutor(Executor executor); @Override void execute(Runnable command); } |
@Test public void withNoContextDefaultIsUsed() throws Exception { executor.execute(captureTask); latch.await(); assertSame(ThreadContext.emptyContext(), contextCapture.get()); } | @Override public void execute(Runnable command) { executor.execute(ThreadContext.current().wrap(command)); } | ContextAwareExecutor implements Executor { @Override public void execute(Runnable command) { executor.execute(ThreadContext.current().wrap(command)); } } | ContextAwareExecutor implements Executor { @Override public void execute(Runnable command) { executor.execute(ThreadContext.current().wrap(command)); } ContextAwareExecutor(Executor executor); } | ContextAwareExecutor implements Executor { @Override public void execute(Runnable command) { executor.execute(ThreadContext.current().wrap(command)); } ContextAwareExecutor(Executor executor); @Override void execute(Runnable command); } | ContextAwareExecutor implements Executor { @Override public void execute(Runnable command) { executor.execute(ThreadContext.current().wrap(command)); } ContextAwareExecutor(Executor executor); @Override void execute(Runnable command); } |
@Test public void keyset() throws Exception { final TypedMap.Key<Double> ka = TypedMap.key("Alpha", Double.class); final TypedMap.Key<String> kb = TypedMap.key("Beta", String.class); final TypedMap.Key<UUID> kc = TypedMap.key("Gamma", UUID.class); final TypedMap.Key<Object> kd = TypedMap.key("Delta", Object.class); fin... | @Override public Set<Key> keySet() { return this.dataMap.keySet(); } | ImmutableTypedMap implements TypedMap { @Override public Set<Key> keySet() { return this.dataMap.keySet(); } } | ImmutableTypedMap implements TypedMap { @Override public Set<Key> keySet() { return this.dataMap.keySet(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); } | ImmutableTypedMap implements TypedMap { @Override public Set<Key> keySet() { return this.dataMap.keySet(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); @Override final T get(Key<T> key); @Override int size(); @Override boolean isEmpty(); @Override Iterator<Entry> iterator(); @Override Iterator<Entry<T>>... | ImmutableTypedMap implements TypedMap { @Override public Set<Key> keySet() { return this.dataMap.keySet(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); @Override final T get(Key<T> key); @Override int size(); @Override boolean isEmpty(); @Override Iterator<Entry> iterator(); @Override Iterator<Entry<T>>... |
@Test public void typedKeyset() throws Exception { final TypedMap.Key<Double> ka = TypedMap.key("A", Double.class); final TypedMap.Key<String> kb = TypedMap.key("B", String.class); final TypedMap.Key<String> kc = TypedMap.key("C", String.class); final TypedMap.Key<Object> kd = TypedMap.key("D", Object.class); final Dou... | @Override public <T> Set<Key<T>> typedKeySet(final Class<T> clazz) { Set<Key<T>> keys = new HashSet<>(); for (Key k : this.keySet()) { if (k.valueType.equals(clazz)) { keys.add(k); } } return Collections.unmodifiableSet(keys); } | ImmutableTypedMap implements TypedMap { @Override public <T> Set<Key<T>> typedKeySet(final Class<T> clazz) { Set<Key<T>> keys = new HashSet<>(); for (Key k : this.keySet()) { if (k.valueType.equals(clazz)) { keys.add(k); } } return Collections.unmodifiableSet(keys); } } | ImmutableTypedMap implements TypedMap { @Override public <T> Set<Key<T>> typedKeySet(final Class<T> clazz) { Set<Key<T>> keys = new HashSet<>(); for (Key k : this.keySet()) { if (k.valueType.equals(clazz)) { keys.add(k); } } return Collections.unmodifiableSet(keys); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> da... | ImmutableTypedMap implements TypedMap { @Override public <T> Set<Key<T>> typedKeySet(final Class<T> clazz) { Set<Key<T>> keys = new HashSet<>(); for (Key k : this.keySet()) { if (k.valueType.equals(clazz)) { keys.add(k); } } return Collections.unmodifiableSet(keys); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> da... | ImmutableTypedMap implements TypedMap { @Override public <T> Set<Key<T>> typedKeySet(final Class<T> clazz) { Set<Key<T>> keys = new HashSet<>(); for (Key k : this.keySet()) { if (k.valueType.equals(clazz)) { keys.add(k); } } return Collections.unmodifiableSet(keys); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> da... |
@Test public void iterator() throws Exception { final TypedMap.Key<Long> ka = TypedMap.key("1", Long.class); final TypedMap.Key<Short> kb = TypedMap.key("2", Short.class); final TypedMap.Key<BigInteger> kc = TypedMap.key("5", BigInteger.class); final Long va = Long.valueOf(999999999); final Short vb = Short.valueOf((sh... | @Override public Iterator<Entry> iterator() { return this.dataMap.values().iterator(); } | ImmutableTypedMap implements TypedMap { @Override public Iterator<Entry> iterator() { return this.dataMap.values().iterator(); } } | ImmutableTypedMap implements TypedMap { @Override public Iterator<Entry> iterator() { return this.dataMap.values().iterator(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); } | ImmutableTypedMap implements TypedMap { @Override public Iterator<Entry> iterator() { return this.dataMap.values().iterator(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); @Override final T get(Key<T> key); @Override int size(); @Override boolean isEmpty(); @Override Iterator<Entry> iterator(); @Overrid... | ImmutableTypedMap implements TypedMap { @Override public Iterator<Entry> iterator() { return this.dataMap.values().iterator(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); @Override final T get(Key<T> key); @Override int size(); @Override boolean isEmpty(); @Override Iterator<Entry> iterator(); @Overrid... |
@Test(expected=UnsupportedOperationException.class) public void iterator_remove() throws Exception { final TypedMap.Key<Long> ka = TypedMap.key("1", Long.class); final Long va = Long.valueOf(999999999); TypedMap data = ImmutableTypedMap.Builder.with(ka, va).build(); Iterator<TypedMap.Entry> it = data.iterator(); it.rem... | @Override public Iterator<Entry> iterator() { return this.dataMap.values().iterator(); } | ImmutableTypedMap implements TypedMap { @Override public Iterator<Entry> iterator() { return this.dataMap.values().iterator(); } } | ImmutableTypedMap implements TypedMap { @Override public Iterator<Entry> iterator() { return this.dataMap.values().iterator(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); } | ImmutableTypedMap implements TypedMap { @Override public Iterator<Entry> iterator() { return this.dataMap.values().iterator(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); @Override final T get(Key<T> key); @Override int size(); @Override boolean isEmpty(); @Override Iterator<Entry> iterator(); @Overrid... | ImmutableTypedMap implements TypedMap { @Override public Iterator<Entry> iterator() { return this.dataMap.values().iterator(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); @Override final T get(Key<T> key); @Override int size(); @Override boolean isEmpty(); @Override Iterator<Entry> iterator(); @Overrid... |
@Test public void forEach() throws Exception { final TypedMap.Key<Long> ka = TypedMap.key("1", Long.class); final TypedMap.Key<Short> kb = TypedMap.key("2", Short.class); final TypedMap.Key<BigInteger> kc = TypedMap.key("5", BigInteger.class); final Long va = Long.valueOf(999999999); final Short vb = Short.valueOf((sho... | @Override public int size() { return this.dataMap.size(); } | ImmutableTypedMap implements TypedMap { @Override public int size() { return this.dataMap.size(); } } | ImmutableTypedMap implements TypedMap { @Override public int size() { return this.dataMap.size(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); } | ImmutableTypedMap implements TypedMap { @Override public int size() { return this.dataMap.size(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); @Override final T get(Key<T> key); @Override int size(); @Override boolean isEmpty(); @Override Iterator<Entry> iterator(); @Override Iterator<Entry<T>> typedIte... | ImmutableTypedMap implements TypedMap { @Override public int size() { return this.dataMap.size(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); @Override final T get(Key<T> key); @Override int size(); @Override boolean isEmpty(); @Override Iterator<Entry> iterator(); @Override Iterator<Entry<T>> typedIte... |
@Test public void typedIterator() throws Exception { final TypedMap.Key<String> ka = TypedMap.key("y", String.class); final TypedMap.Key<Object> kb = TypedMap.key("n", Object.class); final TypedMap.Key<String> kc = TypedMap.key("m", String.class); final String va = "yes"; final String vb = "no"; final String vc = "mayb... | @Override public <T> Iterator<Entry<T>> typedIterator(Class<T> clazz) { List<Entry<T>> entries = new ArrayList(); for (Iterator<Entry> it = this.iterator(); it.hasNext(); ) { final Entry e = it.next(); if (e.getKey().valueType.equals(clazz)) { entries.add(e); } } return Collections.unmodifiableCollection(entries).itera... | ImmutableTypedMap implements TypedMap { @Override public <T> Iterator<Entry<T>> typedIterator(Class<T> clazz) { List<Entry<T>> entries = new ArrayList(); for (Iterator<Entry> it = this.iterator(); it.hasNext(); ) { final Entry e = it.next(); if (e.getKey().valueType.equals(clazz)) { entries.add(e); } } return Collectio... | ImmutableTypedMap implements TypedMap { @Override public <T> Iterator<Entry<T>> typedIterator(Class<T> clazz) { List<Entry<T>> entries = new ArrayList(); for (Iterator<Entry> it = this.iterator(); it.hasNext(); ) { final Entry e = it.next(); if (e.getKey().valueType.equals(clazz)) { entries.add(e); } } return Collectio... | ImmutableTypedMap implements TypedMap { @Override public <T> Iterator<Entry<T>> typedIterator(Class<T> clazz) { List<Entry<T>> entries = new ArrayList(); for (Iterator<Entry> it = this.iterator(); it.hasNext(); ) { final Entry e = it.next(); if (e.getKey().valueType.equals(clazz)) { entries.add(e); } } return Collectio... | ImmutableTypedMap implements TypedMap { @Override public <T> Iterator<Entry<T>> typedIterator(Class<T> clazz) { List<Entry<T>> entries = new ArrayList(); for (Iterator<Entry> it = this.iterator(); it.hasNext(); ) { final Entry e = it.next(); if (e.getKey().valueType.equals(clazz)) { entries.add(e); } } return Collectio... |
@Test(expected=UnsupportedOperationException.class) public void typedIterator_remove() throws Exception { final TypedMap.Key<String> ka = TypedMap.key("y", String.class); final String va = "yes"; TypedMap data = ImmutableTypedMap.Builder.with(ka, va).build(); Iterator<TypedMap.Entry<String>> it = data.typedIterator(Str... | @Override public <T> Iterator<Entry<T>> typedIterator(Class<T> clazz) { List<Entry<T>> entries = new ArrayList(); for (Iterator<Entry> it = this.iterator(); it.hasNext(); ) { final Entry e = it.next(); if (e.getKey().valueType.equals(clazz)) { entries.add(e); } } return Collections.unmodifiableCollection(entries).itera... | ImmutableTypedMap implements TypedMap { @Override public <T> Iterator<Entry<T>> typedIterator(Class<T> clazz) { List<Entry<T>> entries = new ArrayList(); for (Iterator<Entry> it = this.iterator(); it.hasNext(); ) { final Entry e = it.next(); if (e.getKey().valueType.equals(clazz)) { entries.add(e); } } return Collectio... | ImmutableTypedMap implements TypedMap { @Override public <T> Iterator<Entry<T>> typedIterator(Class<T> clazz) { List<Entry<T>> entries = new ArrayList(); for (Iterator<Entry> it = this.iterator(); it.hasNext(); ) { final Entry e = it.next(); if (e.getKey().valueType.equals(clazz)) { entries.add(e); } } return Collectio... | ImmutableTypedMap implements TypedMap { @Override public <T> Iterator<Entry<T>> typedIterator(Class<T> clazz) { List<Entry<T>> entries = new ArrayList(); for (Iterator<Entry> it = this.iterator(); it.hasNext(); ) { final Entry e = it.next(); if (e.getKey().valueType.equals(clazz)) { entries.add(e); } } return Collectio... | ImmutableTypedMap implements TypedMap { @Override public <T> Iterator<Entry<T>> typedIterator(Class<T> clazz) { List<Entry<T>> entries = new ArrayList(); for (Iterator<Entry> it = this.iterator(); it.hasNext(); ) { final Entry e = it.next(); if (e.getKey().valueType.equals(clazz)) { entries.add(e); } } return Collectio... |
@Test public void testCompletionServiceRunnableCaptures() throws InterruptedException, Exception { ExecutorService executor = Executors.newCachedThreadPool(); CompletionService<Object> delegate = new ExecutorCompletionService<>(executor); CompletionService<Object> cs = StateCapture.capturingDecorator(delegate); Capture... | public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } | StateCapture { public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } } | StateCapture { public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } private StateCapture(); } | StateCapture { public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } private StateCapture(); static Executor capturingDecorator(final Executor executor); static Ex... | StateCapture { public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } private StateCapture(); static Executor capturingDecorator(final Executor executor); static Ex... |
@Test public void forEachTyped() throws Exception { final TypedMap.Key<String> ka = TypedMap.key("y", String.class); final TypedMap.Key<Object> kb = TypedMap.key("n", Object.class); final TypedMap.Key<String> kc = TypedMap.key("m", String.class); final TypedMap.Key<Integer> kd = TypedMap.key("s", Integer.class); final ... | @Override public int size() { return this.dataMap.size(); } | ImmutableTypedMap implements TypedMap { @Override public int size() { return this.dataMap.size(); } } | ImmutableTypedMap implements TypedMap { @Override public int size() { return this.dataMap.size(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); } | ImmutableTypedMap implements TypedMap { @Override public int size() { return this.dataMap.size(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); @Override final T get(Key<T> key); @Override int size(); @Override boolean isEmpty(); @Override Iterator<Entry> iterator(); @Override Iterator<Entry<T>> typedIte... | ImmutableTypedMap implements TypedMap { @Override public int size() { return this.dataMap.size(); } private ImmutableTypedMap(Map<Key<?>, Entry<?>> dataMap); @Override final T get(Key<T> key); @Override int size(); @Override boolean isEmpty(); @Override Iterator<Entry> iterator(); @Override Iterator<Entry<T>> typedIte... |
@Test public void testCompletionServiceCallableCaptures() throws InterruptedException, Exception { ExecutorService executor = Executors.newCachedThreadPool(); CompletionService<Object> delegate = new ExecutorCompletionService<>(executor); CompletionService<Object> cs = StateCapture.capturingDecorator(delegate); Capture... | public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } | StateCapture { public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } } | StateCapture { public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } private StateCapture(); } | StateCapture { public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } private StateCapture(); static Executor capturingDecorator(final Executor executor); static Ex... | StateCapture { public static Executor capturingDecorator(final Executor executor) { if (stateCaptors.isEmpty() || executor instanceof CapturingExecutor) { return executor; } else { return new CapturingExecutor(executor); } } private StateCapture(); static Executor capturingDecorator(final Executor executor); static Ex... |
@Test public void nullContextCanHaveAttributes() { TypedMap.Key<String> ID = TypedMap.key("ID", String.class); TypedMap attributes = ImmutableTypedMap.Builder.with(ID, "id").build(); NullContext context = new NullContext(attributes); assertSame(attributes, context.attributes()); } | @Override public TypedMap attributes() { return attributes; } | NullContext implements MetricContext { @Override public TypedMap attributes() { return attributes; } } | NullContext implements MetricContext { @Override public TypedMap attributes() { return attributes; } NullContext(TypedMap attributes); NullContext(TypedMap attributes, MetricContext parent); } | NullContext implements MetricContext { @Override public TypedMap attributes() { return attributes; } NullContext(TypedMap attributes); NullContext(TypedMap attributes, MetricContext parent); static NullContext empty(); @Override TypedMap attributes(); @Override void record(Metric label, Number value, Unit unit, Insta... | NullContext implements MetricContext { @Override public TypedMap attributes() { return attributes; } NullContext(TypedMap attributes); NullContext(TypedMap attributes, MetricContext parent); static NullContext empty(); @Override TypedMap attributes(); @Override void record(Metric label, Number value, Unit unit, Insta... |
@Test public void validation() throws Exception { final String[] goods = { "snake_case_metric", "camelCaseMetric", "hyphenated-metric", "spaced out metric", "digits 0123456789", "G\u00FCnther", "\t\n!\"#$%&'()*+,./:;<=>?@[\\]^`{|}~", " " }; for (String s : goods) { Metric.define(s); } final String[] bads = { null, "" }... | public static Metric define(final String name) { return new Metric(name); } | Metric { public static Metric define(final String name) { return new Metric(name); } } | Metric { public static Metric define(final String name) { return new Metric(name); } private Metric(final String name); } | Metric { public static Metric define(final String name) { return new Metric(name); } private Metric(final String name); static Metric define(final String name); @Override final String toString(); @Override boolean equals(final Object o); @Override int hashCode(); } | Metric { public static Metric define(final String name) { return new Metric(name); } private Metric(final String name); static Metric define(final String name); @Override final String toString(); @Override boolean equals(final Object o); @Override int hashCode(); } |
@Test public void recordIsSentToAllDelegates() { MetricContext context = recorder.context(attributes); context.record(METRIC, 42L, Unit.NONE, timestamp); verify(delegate1).record(eq(METRIC), eq(42L), eq(Unit.NONE), eq(timestamp), argThat(t -> attributes == t.attributes())); verify(delegate2).record(eq(METRIC), eq(42L),... | @Override protected void record(Metric label, Number value, Unit unit, Instant time, MultiRecorderContext context) { context.contexts.parallelStream().forEach(t -> t.record(label, value, unit, time)); } | MultiRecorder extends MetricRecorder<MultiRecorder.MultiRecorderContext> { @Override protected void record(Metric label, Number value, Unit unit, Instant time, MultiRecorderContext context) { context.contexts.parallelStream().forEach(t -> t.record(label, value, unit, time)); } } | MultiRecorder extends MetricRecorder<MultiRecorder.MultiRecorderContext> { @Override protected void record(Metric label, Number value, Unit unit, Instant time, MultiRecorderContext context) { context.contexts.parallelStream().forEach(t -> t.record(label, value, unit, time)); } MultiRecorder(List<MetricRecorder<?>> reco... | MultiRecorder extends MetricRecorder<MultiRecorder.MultiRecorderContext> { @Override protected void record(Metric label, Number value, Unit unit, Instant time, MultiRecorderContext context) { context.contexts.parallelStream().forEach(t -> t.record(label, value, unit, time)); } MultiRecorder(List<MetricRecorder<?>> reco... | MultiRecorder extends MetricRecorder<MultiRecorder.MultiRecorderContext> { @Override protected void record(Metric label, Number value, Unit unit, Instant time, MultiRecorderContext context) { context.contexts.parallelStream().forEach(t -> t.record(label, value, unit, time)); } MultiRecorder(List<MetricRecorder<?>> reco... |
@Test public void countIsSentToAllDelegates() { MetricContext context = recorder.context(attributes); context.count(METRIC, 42L); verify(delegate1).count(eq(METRIC), eq(42L), argThat(t -> attributes == t.attributes())); verify(delegate2).count(eq(METRIC), eq(42L), argThat(t -> attributes == t.attributes())); } | @Override protected void count(Metric label, long delta, MultiRecorderContext context) { context.contexts.parallelStream().forEach(t -> t.count(label, delta)); } | MultiRecorder extends MetricRecorder<MultiRecorder.MultiRecorderContext> { @Override protected void count(Metric label, long delta, MultiRecorderContext context) { context.contexts.parallelStream().forEach(t -> t.count(label, delta)); } } | MultiRecorder extends MetricRecorder<MultiRecorder.MultiRecorderContext> { @Override protected void count(Metric label, long delta, MultiRecorderContext context) { context.contexts.parallelStream().forEach(t -> t.count(label, delta)); } MultiRecorder(List<MetricRecorder<?>> recorders); } | MultiRecorder extends MetricRecorder<MultiRecorder.MultiRecorderContext> { @Override protected void count(Metric label, long delta, MultiRecorderContext context) { context.contexts.parallelStream().forEach(t -> t.count(label, delta)); } MultiRecorder(List<MetricRecorder<?>> recorders); } | MultiRecorder extends MetricRecorder<MultiRecorder.MultiRecorderContext> { @Override protected void count(Metric label, long delta, MultiRecorderContext context) { context.contexts.parallelStream().forEach(t -> t.count(label, delta)); } MultiRecorder(List<MetricRecorder<?>> recorders); } |
@Test public void closeIsSentToAllDelegates() { MetricContext context = recorder.context(attributes); context.close(); verify(delegate1).close(argThat(t -> attributes == t.attributes())); verify(delegate2).close(argThat(t -> attributes == t.attributes())); } | @Override protected void close(MultiRecorderContext context) { context.contexts.parallelStream().forEach(MetricContext::close); } | MultiRecorder extends MetricRecorder<MultiRecorder.MultiRecorderContext> { @Override protected void close(MultiRecorderContext context) { context.contexts.parallelStream().forEach(MetricContext::close); } } | MultiRecorder extends MetricRecorder<MultiRecorder.MultiRecorderContext> { @Override protected void close(MultiRecorderContext context) { context.contexts.parallelStream().forEach(MetricContext::close); } MultiRecorder(List<MetricRecorder<?>> recorders); } | MultiRecorder extends MetricRecorder<MultiRecorder.MultiRecorderContext> { @Override protected void close(MultiRecorderContext context) { context.contexts.parallelStream().forEach(MetricContext::close); } MultiRecorder(List<MetricRecorder<?>> recorders); } | MultiRecorder extends MetricRecorder<MultiRecorder.MultiRecorderContext> { @Override protected void close(MultiRecorderContext context) { context.contexts.parallelStream().forEach(MetricContext::close); } MultiRecorder(List<MetricRecorder<?>> recorders); } |
@Test public void senses() throws Exception { final MetricRecorder recorder = new NullRecorder(); final Sensor sensor1 = mock(Sensor.class); final Sensor sensor2 = mock(Sensor.class); when(sensor1.addContext(any(TypedMap.class))).then(invocation -> invocation.getArgument(0)); when(sensor2.addContext(any(TypedMap.class)... | public void shutdown() { running.set(false); executor.shutdown(); try { executor.awaitTermination(SHUTDOWN_TIMEOUT, TimeUnit.SECONDS); } catch (InterruptedException e) { executor.shutdownNow(); Thread.currentThread().interrupt(); } } | MXBeanPoller { public void shutdown() { running.set(false); executor.shutdown(); try { executor.awaitTermination(SHUTDOWN_TIMEOUT, TimeUnit.SECONDS); } catch (InterruptedException e) { executor.shutdownNow(); Thread.currentThread().interrupt(); } } } | MXBeanPoller { public void shutdown() { running.set(false); executor.shutdown(); try { executor.awaitTermination(SHUTDOWN_TIMEOUT, TimeUnit.SECONDS); } catch (InterruptedException e) { executor.shutdownNow(); Thread.currentThread().interrupt(); } } MXBeanPoller(final MetricRecorder metricRecorder,
... | MXBeanPoller { public void shutdown() { running.set(false); executor.shutdown(); try { executor.awaitTermination(SHUTDOWN_TIMEOUT, TimeUnit.SECONDS); } catch (InterruptedException e) { executor.shutdownNow(); Thread.currentThread().interrupt(); } } MXBeanPoller(final MetricRecorder metricRecorder,
... | MXBeanPoller { public void shutdown() { running.set(false); executor.shutdown(); try { executor.awaitTermination(SHUTDOWN_TIMEOUT, TimeUnit.SECONDS); } catch (InterruptedException e) { executor.shutdownNow(); Thread.currentThread().interrupt(); } } MXBeanPoller(final MetricRecorder metricRecorder,
... |
@Test public void testBasic() throws IOException, SAXException { String s = "the quick brown fox as well as some other fox and quick"; SpanQuery spanQuery = new SpanOrQuery(foxQuick, foxAs, new SpanTermQuery(new Term(field, "fox"))); Analyzer analyzer = new WhitespaceAnalyzer(); ContentHandler handler = new ToHTMLConte... | protected void highlightSingleFieldValue(String field, String s, Set<HighlightingQuery> highlightingQueries, Analyzer analyzer, AtomicBoolean anythingHighlighted, RhapsodeXHTMLHandler xhtml) throws IOException, SAXException { if (highlightingQueries == null || highlightingQueries.size() == 0) { xhtml.characters(s); ret... | DocHighlighter { protected void highlightSingleFieldValue(String field, String s, Set<HighlightingQuery> highlightingQueries, Analyzer analyzer, AtomicBoolean anythingHighlighted, RhapsodeXHTMLHandler xhtml) throws IOException, SAXException { if (highlightingQueries == null || highlightingQueries.size() == 0) { xhtml.c... | DocHighlighter { protected void highlightSingleFieldValue(String field, String s, Set<HighlightingQuery> highlightingQueries, Analyzer analyzer, AtomicBoolean anythingHighlighted, RhapsodeXHTMLHandler xhtml) throws IOException, SAXException { if (highlightingQueries == null || highlightingQueries.size() == 0) { xhtml.c... | DocHighlighter { protected void highlightSingleFieldValue(String field, String s, Set<HighlightingQuery> highlightingQueries, Analyzer analyzer, AtomicBoolean anythingHighlighted, RhapsodeXHTMLHandler xhtml) throws IOException, SAXException { if (highlightingQueries == null || highlightingQueries.size() == 0) { xhtml.c... | DocHighlighter { protected void highlightSingleFieldValue(String field, String s, Set<HighlightingQuery> highlightingQueries, Analyzer analyzer, AtomicBoolean anythingHighlighted, RhapsodeXHTMLHandler xhtml) throws IOException, SAXException { if (highlightingQueries == null || highlightingQueries.size() == 0) { xhtml.c... |
@Test public void testPriority() throws IOException, SAXException { String s = "the quick brown fox as well as some other fox and quick"; SpanQuery spanQuery = new SpanOrQuery(foxQuick, foxAs); Analyzer analyzer = new WhitespaceAnalyzer(); ContentHandler handler = new ToHTMLContentHandler(); RhapsodeXHTMLHandler xhtml ... | protected void highlightSingleFieldValue(String field, String s, Set<HighlightingQuery> highlightingQueries, Analyzer analyzer, AtomicBoolean anythingHighlighted, RhapsodeXHTMLHandler xhtml) throws IOException, SAXException { if (highlightingQueries == null || highlightingQueries.size() == 0) { xhtml.characters(s); ret... | DocHighlighter { protected void highlightSingleFieldValue(String field, String s, Set<HighlightingQuery> highlightingQueries, Analyzer analyzer, AtomicBoolean anythingHighlighted, RhapsodeXHTMLHandler xhtml) throws IOException, SAXException { if (highlightingQueries == null || highlightingQueries.size() == 0) { xhtml.c... | DocHighlighter { protected void highlightSingleFieldValue(String field, String s, Set<HighlightingQuery> highlightingQueries, Analyzer analyzer, AtomicBoolean anythingHighlighted, RhapsodeXHTMLHandler xhtml) throws IOException, SAXException { if (highlightingQueries == null || highlightingQueries.size() == 0) { xhtml.c... | DocHighlighter { protected void highlightSingleFieldValue(String field, String s, Set<HighlightingQuery> highlightingQueries, Analyzer analyzer, AtomicBoolean anythingHighlighted, RhapsodeXHTMLHandler xhtml) throws IOException, SAXException { if (highlightingQueries == null || highlightingQueries.size() == 0) { xhtml.c... | DocHighlighter { protected void highlightSingleFieldValue(String field, String s, Set<HighlightingQuery> highlightingQueries, Analyzer analyzer, AtomicBoolean anythingHighlighted, RhapsodeXHTMLHandler xhtml) throws IOException, SAXException { if (highlightingQueries == null || highlightingQueries.size() == 0) { xhtml.c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.