Skip to content

Commit

Permalink
refactor registerSupportNewProtocol
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenChongze authored and ChenChongze committed Feb 25, 2017
1 parent 3638232 commit 8954860
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,9 @@ public boolean isSupportNewProtocol(String serviceAddress, String serviceName) t
@Override
public void setSupportNewProtocol(String serviceAddress, String serviceName, boolean support)
throws RegistryException {
// only write to zk when support new protocol to relieve the pressure of zk
if (!support) return;

try {
String protocolPath = Utils.getProtocolPath(serviceAddress);
if (client.exists(protocolPath, false)) {
Expand Down Expand Up @@ -516,6 +519,9 @@ public void setSupportNewProtocol(String serviceAddress, String serviceName, boo
@Override
public void unregisterSupportNewProtocol(String serviceAddress, String serviceName, boolean support)
throws RegistryException {
// only write to zk when support new protocol to relieve the pressure of zk
if (!support) return;

try {
String protocolPath = Utils.getProtocolPath(serviceAddress);
if (client.exists(protocolPath, false)) {
Expand Down

0 comments on commit 8954860

Please sign in to comment.