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

Support multiple shared links #2457

Merged
merged 49 commits into from
Feb 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d7092c8
Merge pull request #1 from alibaba/master
Mar 9, 2018
dc602c8
Merge branch 'master' of github.com:manzhizhen/dubbo
Jul 12, 2018
444d70d
Merge pull request #2 from apache/master
Sep 4, 2018
99c6e63
make dubbo support multiple shared links, upgrading RPC throughput
Sep 5, 2018
32197c5
Fix compilation error
Sep 6, 2018
5ecdbe7
Fix compilation error
Sep 6, 2018
71c1ac2
opti import
Sep 6, 2018
1467d21
if add {}
Sep 6, 2018
52a3ac7
checkstyle fail
Sep 6, 2018
1cb48fc
fix getSharedClient referenceCount calculation error bug
Sep 7, 2018
d6ddcd5
优化 import
Sep 7, 2018
f376c1e
Merge pull request #3 from apache/master
Sep 26, 2018
06e29bc
Merge pull request #4 from apache/master
Oct 3, 2018
63962a1
Merge pull request #5 from apache/master
Nov 7, 2018
52d69f3
Merge branch 'master' into mult_shared_links
Nov 7, 2018
b3fdee6
Fix the problem that the getSharedClient thread is not safe
Nov 10, 2018
e75855c
Fix the problem that the getSharedClient thread is not safe
Nov 10, 2018
268f8c4
Merge pull request #6 from apache/master
Nov 10, 2018
39a433c
Merge branch 'master' into mult_shared_links
Nov 10, 2018
560dfb9
Try fixing ci error, https://travis-ci.org/apache/incubator-dubbo/job…
Nov 10, 2018
cf47e78
将DEFAULT_CONNECTIONS_KEY修改成SERVICE_CONNECTIONS_KEY
Nov 11, 2018
13fbc63
Merge pull request #7 from apache/master
Nov 15, 2018
f511240
Merge pull request #8 from apache/master
Nov 20, 2018
7b907c9
Merge pull request #9 from apache/master
Dec 20, 2018
a9e7d87
Merge pull request #10 from apache/master
Dec 22, 2018
768b7b5
Merge branch 'master' into mult_shared_links
Dec 22, 2018
593f4a3
Merge pull request #11 from apache/master
Jan 5, 2019
c75808c
合并master的代码
Jan 5, 2019
d739ded
Merge pull request #12 from apache/master
Jan 12, 2019
9dc2f65
Merge branch 'master' into mult_shared_links
Jan 12, 2019
52efa43
dubbo.xsd add shareconnections attribute,
Jan 13, 2019
33039fc
Optimize code format
Jan 13, 2019
4a5943e
Merge pull request #13 from apache/master
Jan 19, 2019
5aea875
resolve conflict
Jan 19, 2019
9c19fd4
Merge pull request #14 from apache/master
Jan 23, 2019
4cb08bc
merge master,fix conflicts
Jan 23, 2019
8f4efc0
Fix mult connect ghost connect problem
Jan 28, 2019
42fd2c7
format code
Jan 28, 2019
de4c9be
Remove the concept of ghostClientMap and ghost connection. In fact, g…
Jan 31, 2019
209f966
Optimize the ReferenceCountExchangeClient and remove the reference to…
Feb 1, 2019
4d00308
Merge pull request #15 from apache/master
Feb 1, 2019
30557d3
fix conflicts
Feb 1, 2019
9dc5c1b
format code
Feb 1, 2019
dc2bad3
try remove close lock
Feb 2, 2019
53aa630
Restore close method
Feb 2, 2019
5042de1
Merge pull request #16 from apache/master
Feb 2, 2019
6b68053
Merge branch 'master' into mult_shared_links
Feb 2, 2019
35b9e31
Restore ReferenceCountExchangeClient reference to LazyConnectExchange…
Feb 2, 2019
51ba855
Optimize the logic of using the LazyConnectExchangeClient inside the …
Feb 3, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ public class Constants {

public static final int DEFAULT_ALIVE = 60 * 1000;

public static final int DEFAULT_CONNECTIONS = 0;
/**
* By default, a consumer JVM instance and a provider JVM instance share a long TCP connection (except when connections are set),
* which can set the number of long TCP connections shared to avoid the bottleneck of sharing a single long TCP connection.
*/
public static final String DEFAULT_SHARE_CONNECTIONS = "1";

public static final String SHARE_CONNECTIONS_KEY = "shareconnections";

public static final int DEFAULT_ACCEPTS = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public class ConsumerConfig extends AbstractReferenceConfig {
*/
private Integer queues;

/**
* By default, a TCP long-connection communication is shared between the consumer process and the provider process.
* This property can be set to share multiple TCP long-connection communications. Note that only the dubbo protocol takes effect.
*/
private Integer shareconnections;

@Override
public void setTimeout(Integer timeout) {
super.setTimeout(timeout);
Expand Down Expand Up @@ -118,4 +124,12 @@ public Integer getQueues() {
public void setQueues(Integer queues) {
this.queues = queues;
}

public Integer getShareconnections() {
return shareconnections;
}

public void setShareconnections(Integer shareconnections) {
this.shareconnections = shareconnections;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,12 @@
<xsd:documentation><![CDATA[ The thread pool queue size. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="shareconnections" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ The default share connections. default share one connection. ]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:complexContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,30 +174,38 @@ public void send(Object message, boolean sent) throws RemotingException {
}

protected void connect() throws RemotingException {

connectLock.lock();

try {

if (isConnected()) {
return;
}

doConnect();

if (!isConnected()) {
throw new RemotingException(this, "Failed connect to server " + getRemoteAddress() + " from " + getClass().getSimpleName() + " "
+ NetUtils.getLocalHost() + " using dubbo version " + Version.getVersion()
+ ", cause: Connect wait timeout: " + getConnectTimeout() + "ms.");

} else {
if (logger.isInfoEnabled()) {
logger.info("Successed connect to server " + getRemoteAddress() + " from " + getClass().getSimpleName() + " "
+ NetUtils.getLocalHost() + " using dubbo version " + Version.getVersion()
+ ", channel is " + this.getChannel());
}
}

} catch (RemotingException e) {
throw e;

} catch (Throwable e) {
throw new RemotingException(this, "Failed connect to server " + getRemoteAddress() + " from " + getClass().getSimpleName() + " "
+ NetUtils.getLocalHost() + " using dubbo version " + Version.getVersion()
+ ", cause: " + e.getMessage(), e);

} finally {
connectLock.unlock();
}
Expand Down Expand Up @@ -241,23 +249,27 @@ public void reconnect() throws RemotingException {

@Override
public void close() {

try {
super.close();
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}

try {
if (executor != null) {
ExecutorUtil.shutdownNow(executor, 100);
}
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}

try {
disconnect();
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}

try {
doClose();
} catch (Throwable e) {
Expand Down Expand Up @@ -310,5 +322,4 @@ public String toString() {
* @return channel
*/
protected abstract Channel getChannel();

}
Loading