All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.houbb.rpc.client.proxy.impl.DefaultRemoteInvokeContext Maven / Gradle / Ivy

The newest version!
package com.github.houbb.rpc.client.proxy.impl;

import com.github.houbb.rpc.client.proxy.RemoteInvokeContext;
import com.github.houbb.rpc.client.proxy.RemoteInvokeService;
import com.github.houbb.rpc.client.proxy.ServiceContext;
import com.github.houbb.rpc.common.rpc.domain.RpcChannelFuture;
import com.github.houbb.rpc.common.rpc.domain.RpcRequest;
import com.github.houbb.rpc.common.rpc.domain.RpcResponse;
import io.netty.channel.Channel;

/**
 * 默认远程调用上下文实现
 *
 * @author binbin.hou
 * @since 0.1.1
 */
public class DefaultRemoteInvokeContext implements RemoteInvokeContext {

    /**
     * 请求信息
     * @since 0.1.1
     */
    private RpcRequest request;

    /**
     * 服务代理上下文信息
     * @since 0.1.1
     */
    private ServiceContext serviceContext;

    /**
     * channel 信息
     * @since 0.1.1
     */
    private RpcChannelFuture channelFuture;

    /**
     * 请求结果
     * @since 0.1.1
     */
    private RpcResponse rpcResponse;

    /**
     * 重试次数
     * @since 0.1.1
     */
    private int retryTimes;

    /**
     * 全局唯一标识
     * @since 0.1.1
     */
    private String traceId;

    /**
     * 远程调用服务
     * @since 0.1.1
     */
    private RemoteInvokeService remoteInvokeService;

    @Override
    public RpcRequest request() {
        return request;
    }

    public DefaultRemoteInvokeContext request(RpcRequest request) {
        this.request = request;
        return this;
    }

    @Override
    public ServiceContext serviceProxyContext() {
        return serviceContext;
    }

    public DefaultRemoteInvokeContext serviceProxyContext(ServiceContext serviceContext) {
        this.serviceContext = serviceContext;
        return this;
    }

    public RpcChannelFuture channelFuture() {
        return channelFuture;
    }

    @Override
    public DefaultRemoteInvokeContext channelFuture(RpcChannelFuture channelFuture) {
        this.channelFuture = channelFuture;
        return this;
    }

    @Override
    public RpcResponse rpcResponse() {
        return rpcResponse;
    }

    @Override
    public DefaultRemoteInvokeContext rpcResponse(RpcResponse rpcResponse) {
        this.rpcResponse = rpcResponse;
        return this;
    }

    @Override
    public int retryTimes() {
        return retryTimes;
    }

    @Override
    public DefaultRemoteInvokeContext retryTimes(int retryTimes) {
        this.retryTimes = retryTimes;
        return this;
    }

    @Override
    public String traceId() {
        return traceId;
    }

    public DefaultRemoteInvokeContext traceId(String traceId) {
        this.traceId = traceId;
        return this;
    }

    @Override
    public RemoteInvokeService remoteInvokeService() {
        return remoteInvokeService;
    }

    public DefaultRemoteInvokeContext remoteInvokeService(RemoteInvokeService remoteInvokeService) {
        this.remoteInvokeService = remoteInvokeService;
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy