Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.6.x #1

Merged
merged 17 commits into from
Nov 20, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix referenceBean initialization issue (apache#2719)
  • Loading branch information
YoungHu authored and beiwei30 committed Nov 1, 2018
commit bcb1899f3120d2d22b515fbfc383706658901e7b
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ private T createProxy(Map<String, String> map) {
c = true; // default true
}
if (c && !invoker.isAvailable()) {
// make it possible for consumer to retry later if provider is temporarily unavailable
initialized = false;
throw new IllegalStateException("Failed to check the status of the service " + interfaceName + ". No provider available for the service " + (group == null ? "" : group + "/") + interfaceName + (version == null ? "" : ":" + version) + " from the url " + invoker.getUrl() + " to the consumer " + NetUtils.getLocalHost() + " use dubbo version " + Version.getVersion());
}
if (logger.isInfoEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,45 @@ public void testInjvm() throws Exception {
demoService.unexport();
}
}

}
/**
* unit test for dubbo-1765
*/
@Test
public void testReferenceRetry() {
ApplicationConfig application = new ApplicationConfig();
application.setName("test-reference-retry");
RegistryConfig registry = new RegistryConfig();
registry.setAddress("multicast://224.5.6.7:1234");
ProtocolConfig protocol = new ProtocolConfig();
protocol.setName("dubbo");
ReferenceConfig<DemoService> rc = new ReferenceConfig<DemoService>();
rc.setApplication(application);
rc.setRegistry(registry);
rc.setInterface(DemoService.class.getName());
boolean success = false;
DemoService demoService = null;
try {
demoService = rc.get();
success = true;
} catch (Exception e) {
e.printStackTrace();
}
Assert.assertFalse(success);
Assert.assertNull(demoService);
ServiceConfig<DemoService> sc = new ServiceConfig<DemoService>();
sc.setInterface(DemoService.class);
sc.setRef(new DemoServiceImpl());
sc.setApplication(application);
sc.setRegistry(registry);
sc.setProtocol(protocol);
try {
sc.export();
demoService = rc.get();
success = true;
} catch (Exception e) {
e.printStackTrace();
}
Assert.assertTrue(success);
Assert.assertNotNull(demoService);
}
}