in safeguard-impl/src/main/java/org/apache/safeguard/impl/cdi/SafeguardExtension.java [221:278]
private Throwable validate(final Annotated annotated) { // todo: do we want to cache here too or save some memory
{ // timeout
final Throwable throwable = validate(Timeout.class, annotated, context -> {
if (timeoutCache == null) {
timeoutCache = getInstance(TimeoutInterceptor.Cache.class);
}
timeoutCache.create(context);
});
if (throwable != null) {
return throwable;
}
}
{ // bulkhead
final Throwable throwable = validate(Bulkhead.class, annotated, context -> {
if (bulkHeadCache == null) {
bulkHeadCache = getInstance(BulkheadInterceptor.Cache.class);
}
bulkHeadCache.create(context);
});
if (throwable != null) {
return throwable;
}
}
{ // circuit breaker
final Throwable throwable = validate(CircuitBreaker.class, annotated, context -> {
if (circuitBreakerCache == null) {
circuitBreakerCache = getInstance(CircuitBreakerInterceptor.Cache.class);
}
circuitBreakerCache.create(context);
});
if (throwable != null) {
return throwable;
}
}
{ // fallback
final Throwable throwable = validate(Fallback.class, annotated, context -> {
if (fallbackCache == null) {
fallbackCache = getInstance(FallbackInterceptor.Cache.class);
}
fallbackCache.create(context);
});
if (throwable != null) {
return throwable;
}
}
{ // retry
final Throwable throwable = validate(Retry.class, annotated, context -> {
if (retryCache == null) {
retryCache = getInstance(BaseRetryInterceptor.Cache.class);
}
retryCache.create(context);
});
if (throwable != null) {
return throwable;
}
}
return null;
}