Skip to content

ReferenceConfig initialized not changed to false once subscribe throws exception #PR:4067 #4068

Closed
@haiyang1985

Description

@haiyang1985
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

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

  1. Run consumer without provider as below, it throws No provider exception.
ReferenceConfigCache cache = ReferenceConfigCache.getCache();
DemoService demoService = (DemoService) cache.get(reference);
demoService.sayHello("hi");
  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions