Skip to content

Commit

Permalink
Fix the provider config repeated export limit. (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjboy authored May 30, 2018
1 parent 2eb77a9 commit aab9704
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ protected DefaultProviderBootstrap(ProviderConfig<T> providerConfig) {
/**
* 是否已发布
*/
protected transient volatile boolean exported;
protected transient volatile boolean exported;

/**
* 服务端Invoker对象
*/
protected transient Invoker providerProxyInvoker;
protected transient Invoker providerProxyInvoker;

/**
* 发布的服务配置
*/
protected final ConcurrentHashMap<String, AtomicInteger> EXPORTED_KEYS = new ConcurrentHashMap<String, AtomicInteger>();
protected final static ConcurrentHashMap<String, AtomicInteger> EXPORTED_KEYS = new ConcurrentHashMap<String, AtomicInteger>();

@Override
public void export() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void refer() throws Exception {
.setTimeout(3000);
try {
consumerConfig3.refer();
Assert.fail();
} catch (Exception e) {
Assert.assertTrue(e instanceof SofaRpcRuntimeException);
}
Expand All @@ -85,6 +86,7 @@ public void refer() throws Exception {
.setTimeout(3000);
try {
consumerConfig5.refer();
Assert.fail();
} catch (Exception e) {
Assert.assertTrue(e instanceof SofaRpcRuntimeException);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public void export() throws Exception {
.setRegister(false);
try {
providerConfig1.export();
Assert.fail();
} catch (Exception e) {
Assert.assertTrue(e instanceof SofaRpcRuntimeException);
}
Expand All @@ -72,7 +73,7 @@ public void export() throws Exception {
.setInterfaceId(HelloService.class.getName())
.setRef(new HelloServiceImpl(2000))
.setServer(serverConfig)
.setRepeatedExportLimit(3)
.setRepeatedExportLimit(2)
.setRegister(false);
providerConfig2.export();

Expand All @@ -81,10 +82,11 @@ public void export() throws Exception {
.setInterfaceId(HelloService.class.getName())
.setRef(new HelloServiceImpl(2000))
.setServer(serverConfig)
.setRepeatedExportLimit(3)
.setRepeatedExportLimit(2)
.setRegister(false);
try {
providerConfig3.export();
Assert.fail();
} catch (Exception e) {
Assert.assertTrue(e instanceof SofaRpcRuntimeException);
}
Expand Down

0 comments on commit aab9704

Please sign in to comment.