Service callback throws "Not found exported service" when 'bind.port' is set (#6223)
This commit is contained in:
parent
1c407deb00
commit
ba89f44f5a
|
|
@ -24,6 +24,7 @@ import org.apache.dubbo.common.logger.LoggerFactory;
|
|||
import org.apache.dubbo.common.utils.ConcurrentHashSet;
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
import org.apache.dubbo.remoting.Channel;
|
||||
import org.apache.dubbo.remoting.Constants;
|
||||
import org.apache.dubbo.remoting.RemotingException;
|
||||
import org.apache.dubbo.rpc.Exporter;
|
||||
import org.apache.dubbo.rpc.Invocation;
|
||||
|
|
@ -113,7 +114,9 @@ class CallbackServiceCodec {
|
|||
}
|
||||
}
|
||||
tmpMap.putAll(params);
|
||||
|
||||
tmpMap.remove(VERSION_KEY);// doesn't need to distinguish version for callback
|
||||
tmpMap.remove(Constants.BIND_PORT_KEY); //callback doesn't needs bind.port
|
||||
tmpMap.put(INTERFACE_KEY, clazz.getName());
|
||||
URL exportUrl = new URL(DubboProtocol.NAME, channel.getLocalAddress().getAddress().getHostAddress(), channel.getLocalAddress().getPort(), clazz.getName() + "." + instid, tmpMap);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,19 +16,7 @@
|
|||
*/
|
||||
package org.apache.dubbo.rpc.protocol.dubbo;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.utils.NetUtils;
|
||||
import org.apache.dubbo.rpc.Exporter;
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.RpcException;
|
||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||
import org.apache.dubbo.rpc.protocol.dubbo.support.ProtocolUtils;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.CALLBACK_INSTANCES_LIMIT_KEY;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -36,7 +24,19 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.CALLBACK_INSTANCES_LIMIT_KEY;
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.utils.NetUtils;
|
||||
import org.apache.dubbo.rpc.Exporter;
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.RpcException;
|
||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||
import org.apache.dubbo.rpc.protocol.dubbo.support.ProtocolUtils;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.apache.dubbo.remoting.Constants;
|
||||
|
||||
public class ArgumentCallbackTest {
|
||||
|
||||
|
|
@ -104,6 +104,27 @@ public class ArgumentCallbackTest {
|
|||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestCallbackNormalWithBindPort() throws Exception {
|
||||
initOrResetUrl(1, 10000000);
|
||||
consumerUrl = serviceURL.addParameter(Constants.BIND_PORT_KEY,"7653");
|
||||
initOrResetService();
|
||||
|
||||
final AtomicInteger count = new AtomicInteger(0);
|
||||
|
||||
demoProxy.xxx(new IDemoCallback() {
|
||||
public String yyy(String msg) {
|
||||
System.out.println("Recived callback: " + msg);
|
||||
count.incrementAndGet();
|
||||
return "ok";
|
||||
}
|
||||
}, "other custom args", 10, 100);
|
||||
System.out.println("Async...");
|
||||
assertCallbackCount(10, 100, count);
|
||||
destroyService();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestCallbackNormal() throws Exception {
|
||||
|
|
|
|||
Loading…
Reference in New Issue