You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by je...@apache.org on 2018/09/25 09:46:39 UTC
[incubator-dubbo] branch master updated: fix #2533,
set timeout to 3000 (#2552)
This is an automated email from the ASF dual-hosted git repository.
jerrick pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 4fd352b fix #2533, set timeout to 3000 (#2552)
4fd352b is described below
commit 4fd352b6c3c4027c312b35b7b49ac82bf320f0ad
Author: Jerrick Zhu <di...@gmail.com>
AuthorDate: Tue Sep 25 17:46:30 2018 +0800
fix #2533, set timeout to 3000 (#2552)
* fix #2533, set timeout to 3000
* change timeout
---
.../apache/dubbo/generic/GenericServiceTest.java | 2 +-
.../rpc/protocol/dubbo/DubboProtocolTest.java | 24 +++++++++++-----------
.../rpc/protocol/dubbo/ExplicitCallbackTest.java | 5 ++---
3 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java
index f31234b..9bc4cdc 100644
--- a/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java
+++ b/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java
@@ -58,7 +58,7 @@ public class GenericServiceTest {
DemoService server = new DemoServiceImpl();
ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension();
Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension();
- URL url = URL.valueOf("dubbo://127.0.0.1:5342/" + DemoService.class.getName() + "?version=1.0.0&generic=true");
+ URL url = URL.valueOf("dubbo://127.0.0.1:5342/" + DemoService.class.getName() + "?version=1.0.0&generic=true$timeout=3000");
Exporter<DemoService> exporter = protocol.export(proxyFactory.getInvoker(server, DemoService.class, url));
Invoker<GenericService> invoker = protocol.refer(GenericService.class, url);
diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java
index 32dd1f4..7366ed1 100644
--- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java
+++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java
@@ -52,7 +52,7 @@ public class DubboProtocolTest {
public void testDemoProtocol() throws Exception {
DemoService service = new DemoServiceImpl();
protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9020/" + DemoService.class.getName() + "?codec=exchange")));
- service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9020/" + DemoService.class.getName() + "?codec=exchange")));
+ service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9020/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", 3000l)));
assertEquals(service.getSize(new String[]{"", "", ""}), 3);
}
@@ -60,7 +60,7 @@ public class DubboProtocolTest {
public void testDubboProtocol() throws Exception {
DemoService service = new DemoServiceImpl();
protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName())));
- service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName())));
+ service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()).addParameter("timeout", 3000l)));
assertEquals(service.enumlength(new Type[]{}), Type.Lower);
assertEquals(service.getSize(null), -1);
assertEquals(service.getSize(new String[]{"", "", ""}), 3);
@@ -71,7 +71,7 @@ public class DubboProtocolTest {
assertEquals(set.iterator().next(), "aa");
service.invoke("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "", "invoke");
- service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=netty")));
+ service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=netty").addParameter("timeout", 3000l)));
// test netty client
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 1024 * 32 + 32; i++)
@@ -79,7 +79,7 @@ public class DubboProtocolTest {
System.out.println(service.stringLength(buf.toString()));
// cast to EchoService
- EchoService echo = proxy.getProxy(protocol.refer(EchoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=netty")));
+ EchoService echo = proxy.getProxy(protocol.refer(EchoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=netty").addParameter("timeout", 3000l)));
assertEquals(echo.$echo(buf.toString()), buf.toString());
assertEquals(echo.$echo("test"), "test");
assertEquals(echo.$echo("abcdefg"), "abcdefg");
@@ -90,7 +90,7 @@ public class DubboProtocolTest {
public void testDubboProtocolWithMina() throws Exception {
DemoService service = new DemoServiceImpl();
protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()).addParameter(Constants.SERVER_KEY, "mina")));
- service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()).addParameter(Constants.CLIENT_KEY, "mina")));
+ service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()).addParameter(Constants.CLIENT_KEY, "mina").addParameter("timeout", 3000l)));
for (int i = 0; i < 10; i++) {
assertEquals(service.enumlength(new Type[]{}), Type.Lower);
assertEquals(service.getSize(null), -1);
@@ -105,7 +105,7 @@ public class DubboProtocolTest {
service.invoke("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "", "invoke");
}
- service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=mina")));
+ service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=mina").addParameter("timeout", 3000l)));
// test netty client
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 1024 * 32 + 32; i++)
@@ -113,7 +113,7 @@ public class DubboProtocolTest {
System.out.println(service.stringLength(buf.toString()));
// cast to EchoService
- EchoService echo = proxy.getProxy(protocol.refer(EchoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=mina")));
+ EchoService echo = proxy.getProxy(protocol.refer(EchoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=mina").addParameter("timeout", 3000l)));
for (int i = 0; i < 10; i++) {
assertEquals(echo.$echo(buf.toString()), buf.toString());
assertEquals(echo.$echo("test"), "test");
@@ -126,11 +126,11 @@ public class DubboProtocolTest {
public void testDubboProtocolMultiService() throws Exception {
DemoService service = new DemoServiceImpl();
protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName())));
- service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName())));
+ service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()).addParameter("timeout", 3000l)));
RemoteService remote = new RemoteServiceImpl();
protocol.export(proxy.getInvoker(remote, RemoteService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + RemoteService.class.getName())));
- remote = proxy.getProxy(protocol.refer(RemoteService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + RemoteService.class.getName())));
+ remote = proxy.getProxy(protocol.refer(RemoteService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + RemoteService.class.getName()).addParameter("timeout", 3000l)));
service.sayHello("world");
@@ -149,7 +149,7 @@ public class DubboProtocolTest {
public void testPerm() throws Exception {
DemoService service = new DemoServiceImpl();
protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange")));
- service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange")));
+ service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", 3000l)));
long start = System.currentTimeMillis();
for (int i = 0; i < 1000; i++)
service.getSize(new String[]{"", "", ""});
@@ -160,7 +160,7 @@ public class DubboProtocolTest {
public void testNonSerializedParameter() throws Exception {
DemoService service = new DemoServiceImpl();
protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange")));
- service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange")));
+ service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", 3000l)));
try {
service.nonSerializedParameter(new NonSerialized());
Assert.fail();
@@ -173,7 +173,7 @@ public class DubboProtocolTest {
public void testReturnNonSerialized() throws Exception {
DemoService service = new DemoServiceImpl();
protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange")));
- service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange")));
+ service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", 3000l)));
try {
service.returnNonSerialized();
Assert.fail();
diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ExplicitCallbackTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ExplicitCallbackTest.java
index 623be86..3c8aecd 100644
--- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ExplicitCallbackTest.java
+++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ExplicitCallbackTest.java
@@ -122,7 +122,7 @@ public class ExplicitCallbackTest {
@Test
public void TestCallbackMultiInstans() throws Exception {
- initOrResetUrl(2, 1000);
+ initOrResetUrl(2, 3000);
initOrResetService();
IDemoCallback callback = new IDemoCallback() {
public String yyy(String msg) {
@@ -143,14 +143,13 @@ public class ExplicitCallbackTest {
Thread.sleep(500);
demoProxy.unxxx2(callback);
Assert.assertEquals(0, demoProxy.getCallbackCount());
- System.out.println("");
demoProxy.xxx2(callback2);
Assert.assertEquals(1, demoProxy.getCallbackCount());
Thread.sleep(500);
demoProxy.unxxx2(callback2);
Assert.assertEquals(0, demoProxy.getCallbackCount());
- System.out.println("");
+
demoProxy.xxx2(callback);
Thread.sleep(500);
Assert.assertEquals(1, demoProxy.getCallbackCount());