Environment
- Dubbo version: 2.7.1
- Operating System version: mac sierra 10.12
- Java version: 1.8
Steps to reproduce this issue
For PR: #4067
- Run consumer without provider as below, it throws No provider exception.
ReferenceConfigCache cache = ReferenceConfigCache.getCache();
DemoService demoService = (DemoService) cache.get(reference);
demoService.sayHello("hi");
- Start provider and then run consumer again, get null from the demoService.
ReferenceConfigCache cache = ReferenceConfigCache.getCache();
DemoService demoService = (DemoService) cache.get(reference);
Pls. provide [GitHub address] to reproduce this issue.
Expected Result
DemoService should be initialized.
Actual Result
DemoService returns null even with provider started.
For the first time, the ReferenceConfig init throws exception from refprotocol.refer(interfaceClass, urls.get(0)), have not changed the initialized to false. For the second time, the ReferenceConfig cannot init it again as initialized is true.
We should set initialized after init finished.
Environment
Steps to reproduce this issue
For PR: #4067
Pls. provide [GitHub address] to reproduce this issue.
Expected Result
DemoService should be initialized.
Actual Result
DemoService returns null even with provider started.
For the first time, the ReferenceConfig init throws exception from refprotocol.refer(interfaceClass, urls.get(0)), have not changed the initialized to false. For the second time, the ReferenceConfig cannot init it again as initialized is true.
We should set initialized after init finished.