
io.vertx.up.uca.monitor.meansure.AbstractQuota Maven / Gradle / Ivy
package io.vertx.up.uca.monitor.meansure;
import io.vertx.core.Vertx;
import io.vertx.core.shareddata.AsyncMap;
import java.util.Objects;
import java.util.function.Consumer;
/**
* @author Lang
*/
public abstract class AbstractQuota implements Quota {
protected final transient Vertx vertx;
public AbstractQuota(final Vertx vertx) {
this.vertx = vertx;
}
protected void mapAsync(final String name, final Consumer> consumer) {
this.vertx.sharedData().getAsyncMap(name, mapped -> {
if (mapped.succeeded()) {
consumer.accept(mapped.result());
} else {
if (Objects.nonNull(mapped.cause())) {
mapped.cause().printStackTrace();
}
}
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy