io.nosqlbench.engine.api.activityapi.errorhandling.modular.ResultCode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of engine-api Show documentation
Show all versions of engine-api Show documentation
The engine API for nosqlbench;
Provides the interfaces needed to build internal modules for the
nosqlbench core engine
package io.nosqlbench.engine.api.activityapi.errorhandling.modular;
import io.nosqlbench.nb.annotations.Service;
import io.nosqlbench.nb.api.config.standard.ConfigModel;
import io.nosqlbench.nb.api.config.standard.NBConfigModel;
import io.nosqlbench.nb.api.config.standard.NBMapConfigurable;
import io.nosqlbench.nb.api.config.standard.Param;
import java.util.Map;
@Service(value = ErrorHandler.class, selector = "code")
public class ResultCode implements ErrorHandler, NBMapConfigurable {
private byte code;
@Override
public ErrorDetail handleError(String name, Throwable t, long cycle, long durationInNanos, ErrorDetail detail) {
return detail.withResultCode(code);
}
@Override
public void applyConfig(Map providedConfig) {
this.code = Byte.valueOf(providedConfig.get("code").toString());
}
@Override
public NBConfigModel getConfigModel() {
return ConfigModel.of(this.getClass())
.add(Param.required("code", Byte.class))
.asReadOnly();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy