shenyu icon indicating copy to clipboard operation
shenyu copied to clipboard

[Question] some code is not used in shenyu-client-dubbo?

Open midnight2104 opened this issue 2 years ago • 6 comments

Question

  1. org.apache.shenyu.client.apache.dubbo.ApacheDubboServiceBeanListener
    public ApacheDubboServiceBeanListener(final PropertiesConfig clientConfig, final ShenyuClientRegisterRepository shenyuClientRegisterRepository) {
        Properties props = clientConfig.getProps();
        String contextPath = props.getProperty(ShenyuClientConstants.CONTEXT_PATH);
        String appName = props.getProperty(ShenyuClientConstants.APP_NAME);
        if (StringUtils.isBlank(contextPath)) {
            throw new ShenyuClientIllegalArgumentException("apache dubbo client must config the contextPath or appName");
        }
        this.contextPath = contextPath;
        this.appName = appName;
        this.host = props.getProperty(ShenyuClientConstants.HOST);
        this.port = props.getProperty(ShenyuClientConstants.PORT);
        executorService = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("shenyu-apache-dubbo-client-thread-pool-%d").build());
        publisher.start(shenyuClientRegisterRepository);
    }

A thread pool(executorService ) was created in the constructor, but not used. Is it possible to delete it?

  1. ShenyuDubboClient Does ShenyuDubboClient only work on methods and not on classes? The current definitions are as follows:

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@Inherited
public @interface ShenyuDubboClient {

    /**
     * Path string.
     *
     * @return the string
     */
    String path();

    /**
     * Rule name string.
     *
     * @return the string
     */
    String ruleName() default "";

    /**
     * Desc string.
     *
     * @return String string
     */
    String desc() default "";

    /**
     * Enabled boolean.
     *
     * @return the boolean
     */
    boolean enabled() default true;
}

Shouldn't we change @Target({ElementType.TYPE, ElementType.METHOD}) to @Target({ElementType.METHOD})?

midnight2104 avatar Apr 25 '22 02:04 midnight2104

I think we should add the logic of annotation on the splicing class. Guys,what do you think ?

------------------ 原始邮件 ------------------ 发件人: "apache/incubator-shenyu" @.>; 发送时间: 2022年4月25日(星期一) 上午10:08 @.>; @.***>; 主题: [apache/incubator-shenyu] [Question] some code is not used in shenyu-client-dubbo? (Issue #3317)

Question

org.apache.shenyu.client.apache.dubbo.ApacheDubboServiceBeanListener public ApacheDubboServiceBeanListener(final PropertiesConfig clientConfig, final ShenyuClientRegisterRepository shenyuClientRegisterRepository) { Properties props = clientConfig.getProps(); String contextPath = props.getProperty(ShenyuClientConstants.CONTEXT_PATH); String appName = props.getProperty(ShenyuClientConstants.APP_NAME); if (StringUtils.isBlank(contextPath)) { throw new ShenyuClientIllegalArgumentException("apache dubbo client must config the contextPath or appName"); } this.contextPath = contextPath; this.appName = appName; this.host = props.getProperty(ShenyuClientConstants.HOST); this.port = props.getProperty(ShenyuClientConstants.PORT); executorService = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("shenyu-apache-dubbo-client-thread-pool-%d").build()); publisher.start(shenyuClientRegisterRepository); }

A thread pool(executorService ) was created in the constructor, but not used. Is it possible to delete it?

ShenyuDubboClient Does ShenyuDubboClient only work on methods and not on classes? The current definitions are as follows: @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) @Inherited public @interface ShenyuDubboClient { /** * Path string. * * @return the string / String path(); /* * Rule name string. * * @return the string / String ruleName() default ""; /* * Desc string. * * @return String string / String desc() default ""; /* * Enabled boolean. * * @return the boolean */ boolean enabled() default true; }

Shouldn't we change @Target({ElementType.TYPE, ElementType.METHOD}) to @Target({ElementType.METHOD})?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

loongs-zhang avatar Apr 25 '22 06:04 loongs-zhang

yes, I think so.

midnight2104 avatar Apr 25 '22 09:04 midnight2104

yes, I think so.

How about publishing tasks and asking friends in the community to help?

loongs-zhang avatar Apr 26 '22 14:04 loongs-zhang

I checked the TarsServiceBeanPostProcessor and GrpcClientBeanPostProcessor and found that maybe all RPC client has this bug.

loongs-zhang avatar Apr 26 '22 14:04 loongs-zhang

yes, I think so.

How about publishing tasks and asking friends in the community to help?

It's ok

midnight2104 avatar Apr 27 '22 12:04 midnight2104

I checked the TarsServiceBeanPostProcessor and GrpcClientBeanPostProcessor and found that maybe all RPC client has this bug.

good job

midnight2104 avatar Apr 27 '22 12:04 midnight2104