How to set the number of connections?
- Dominant language
- Java
- Stars
- 41.6k
- Forks
- 26.4k
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 4
Description
**### Question:reference.setConnections(10);//设置未生效**

**There is only one connection. How do you make multiple connections**?
server
```
public class EchoServer {
public static void main(String[] args) throws IOException {
ServiceConfig service = new ServiceConfig<>();
service.setInterface(EchoService.class);
service.setRef(new EchoImpl());
DubboBootstrap bootstrap = DubboBootstrap.getInstance();
bootstrap.application(new ApplicationConfig("tri-stub-server"))
// .registry(new RegistryConfig("multicast://127.0.0.1:2181"))
.protocol(new ProtocolConfig(CommonConstants.TRIPLE, 3002))
.service(service)
.start();
System.out.println("Dubbo triple stub server started");
System.in.read();
}
}
```
client
```
public class EchoClient {
public static void main(String[] args) throws IOException {
for (int i = 0; i < 3; i++) {
new Thread(()->{
DubboBootstrap bootstrap = DubboBootstrap.newInstance();
System.out.println(bootstrap);
ReferenceConfig ref = new ReferenceConfig<>();
ref.setInterface(EchoService.class);
ref.setProtocol(CommonConstants.TRIPLE);
ref.setProxy(CommonConstants.NATIVE_STUB);
ref.setTimeout(3000);
ref.setUrl("tri://127.0.0.1:3002");
ref.setConnections(10);//设置未生效
bootstrap.application(new ApplicationConfig("tri-stub-client"))
.reference(ref)
.start();
EchoService echoService = ref.get();
// Scanner sc = new Scanner(System.in);
while (true){
// String input = sc.next();
EchoRequest request = EchoRequest.newBuilder().setMessage("input").build();
EchoResponse echoResponse = echoService.echo(request);
System.out.println("Received reply:" + echoResponse.getMessage());
}
}).start();
}
System.in.read();
}
}
```
Contributor guide
Research direction
Start with the EchoClient entry point and the ReferenceConfig.setConnections(10) call, then trace the Triple reference setup used by the sample. Reproduce the client against the EchoServer and inspect how many connections are created; done means the configured connection count is effective or the supported configuration and limitation are documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design, distributed-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100