org.lognet.springboot.grpc.recovery.GRpcExceptionHandlerMethodResolver Maven / Gradle / Ivy
The newest version!
package org.lognet.springboot.grpc.recovery;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.lognet.springboot.grpc.GRpcServicesRegistry;
import org.springframework.core.ExceptionDepthComparator;
import org.springframework.core.MethodIntrospector;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.ConcurrentReferenceHashMap;
import org.springframework.util.ReflectionUtils;
public class GRpcExceptionHandlerMethodResolver {
private final Map, HandlerMethod> mappedHandlers = new HashMap<>(16);
private final Map, HandlerMethod> exceptionLookupCache =
new ConcurrentReferenceHashMap<>(16);
private Map privateResolvers;
public GRpcExceptionHandlerMethodResolver(
GRpcServicesRegistry registry, Collection