Java Code Examples for com.alipay.sofa.rpc.core.request.SofaRequest#getMethod()

The following examples show how to use com.alipay.sofa.rpc.core.request.SofaRequest#getMethod() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultSetterFactory.java    From sofa-rpc with Apache License 2.0 6 votes vote down vote up
@Override
public HystrixCommand.Setter createSetter(FilterInvoker invoker, SofaRequest request) {
    Method clientMethod = request.getMethod();
    if (!SETTER_CACHE.containsKey(clientMethod)) {
        synchronized (DefaultSetterFactory.class) {
            if (!SETTER_CACHE.containsKey(clientMethod)) {
                String interfaceId = invoker.getConfig().getInterfaceId();
                String commandKey = generateCommandKey(interfaceId, request.getMethod());
                HystrixCommand.Setter setter = HystrixCommand.Setter
                    .withGroupKey(HystrixCommandGroupKey.Factory.asKey(interfaceId))
                    .andCommandKey(HystrixCommandKey.Factory.asKey(commandKey));
                SETTER_CACHE.put(clientMethod, setter);
            }
        }
    }
    return SETTER_CACHE.get(clientMethod);
}
 
Example 2
Source File: AbstractCluster.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
private SofaResponse buildEmptyResponse(SofaRequest request) {
    SofaResponse response = new SofaResponse();
    Method method = request.getMethod();
    if (method != null) {
        response.setAppResponse(ClassUtils.getDefaultPrimitiveValue(method.getReturnType()));
    }
    return response;
}
 
Example 3
Source File: SofaAsyncHystrixCommand.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
private SofaResponse buildEmptyResponse(SofaRequest request) {
    SofaResponse response = new SofaResponse();
    Method method = request.getMethod();
    if (method != null) {
        response.setAppResponse(ClassUtils.getDefaultPrimitiveValue(method.getReturnType()));
    }
    return response;
}