io.openlineage.client.circuitBreaker.CircuitBreakerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openlineage-java Show documentation
Show all versions of openlineage-java Show documentation
Java library for OpenLineage
/*
/* Copyright 2018-2024 contributors to the OpenLineage project
/* SPDX-License-Identifier: Apache-2.0
*/
package io.openlineage.client.circuitBreaker;
public class CircuitBreakerFactory {
private final CircuitBreakerConfig circuitBreakerConfig;
public CircuitBreakerFactory(final CircuitBreakerConfig circuitBreakerConfig) {
this.circuitBreakerConfig = circuitBreakerConfig;
}
public CircuitBreaker build() {
if (circuitBreakerConfig instanceof JavaRuntimeCircuitBreakerConfig) {
return new JavaRuntimeCircuitBreaker((JavaRuntimeCircuitBreakerConfig) circuitBreakerConfig);
} else if (circuitBreakerConfig instanceof SimpleMemoryCircuitBreakerConfig) {
return new SimpleMemoryCircuitBreaker(
(SimpleMemoryCircuitBreakerConfig) circuitBreakerConfig);
} else if (circuitBreakerConfig instanceof StaticCircuitBreakerConfig) {
return new StaticCircuitBreaker((StaticCircuitBreakerConfig) circuitBreakerConfig);
}
return new NoOpCircuitBreaker();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy