Skip to content

Instantly share code, notes, and snippets.

@dalexandrov
Created February 23, 2021 14:39
Show Gist options
  • Save dalexandrov/a60afbca1b35d6bac32ddf61f34a9d02 to your computer and use it in GitHub Desktop.
Save dalexandrov/a60afbca1b35d6bac32ddf61f34a9d02 to your computer and use it in GitHub Desktop.
private static class Neo4JCounterWrapper implements Counter {
private final Supplier<Long> fn;
private Neo4JCounterWrapper(Supplier<Long> fn) {
this.fn = fn;
}
@Override
public void inc() {
throw new UnsupportedOperationException();
}
@Override
public void inc(long n) {
throw new UnsupportedOperationException();
}
@Override
public long getCount() {
return fn.get();
}
}
private static class Neo4JGaugeWrapper<T> implements Gauge<T> {
private final Supplier<T> supplier;
private Neo4JGaugeWrapper(Supplier<T> supplier) {
this.supplier = supplier;
}
@Override
public T getValue() {
return supplier.get();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment