dubbo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From haiyang1985 (GitHub) <git...@apache.org>
Subject [GitHub] [incubator-dubbo] haiyang1985 opened issue #3781: ReferenceConfigCache cannot recover with providers.
Date Mon, 01 Apr 2019 06:04:24 GMT
- [ ] I have searched the [issues](https://github.com/apache/incubator-dubbo/issues) of this
repository and believe that this is not a duplicate.
- [ ] I have checked the [FAQ](https://github.com/apache/incubator-dubbo/blob/master/FAQ.md)
of this repository and believe that this is not a duplicate.

### Environment

* Dubbo version: 2.7.0
* Operating System version: mac
* Java version: 1.8

### Steps to reproduce this issue

1. start the consumer without provider, and it will throw "No Provider" exception. Below is
not the full of my code, simplify on the ReferenceConfig.
  ReferenceConfigCache cache = ReferenceConfigCache.getCache();
  Object proxy = cache.get(new ReferenceConfig());
}catch (Throwable e){

2. Start the provider 
3. Always get null even the provider started. 
Object proxyNew = cache.get(config);

Pls. provide [GitHub address] to reproduce this issue.

### Expected Result
We are able to get proxy after start up the  provider.
Object proxyNew = cache.get(config);

### Actual Result

What actually happens?
cache always return null even provider started.

I think, we have to return null once consumer startup failed. 
public <T> T get(ReferenceConfig<T> referenceConfig) {
    String key = generator.generateKey(referenceConfig);

    ReferenceConfig<?> config = cache.get(key);
    if (config != null) {
        return (T) config.get();

    T t = referenceConfig.get();
    if (null == t){
        return null;
        cache.putIfAbsent(key, referenceConfig);
        return t;

Otherwise, the consumer cannot recover, as it have been initialized. The solution of #2233
is not able to resolve the issue.
private void init() {
    if (initialized) {
    initialized = true;

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3781 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

View raw message