forked from apache/dubbo
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Polish /apache#3942 : Refactor implementation
- Loading branch information
1 parent
3ac778c
commit a8526da
Showing
9 changed files
with
55 additions
and
134 deletions.
There are no files selected for viewing
74 changes: 0 additions & 74 deletions
74
...ry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceDiscoveryFactory.java
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
...rc/main/java/org/apache/dubbo/registry/client/EventPublishingServiceDiscoveryFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.apache.dubbo.registry.client;/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import org.apache.dubbo.common.URL; | ||
import org.apache.dubbo.common.extension.SPI; | ||
|
||
import static org.apache.dubbo.common.extension.ExtensionLoader.getExtensionLoader; | ||
|
||
/** | ||
* The factory class to create an instance of {@link ServiceDiscoveryFactory} based on Event-Publishing as the default | ||
* {@link SPI} implementation | ||
* | ||
* @see ServiceDiscoveryFactory | ||
* @see EventPublishingServiceDiscovery | ||
* @see ServiceDiscovery | ||
* @since 2.7.3 | ||
*/ | ||
public class EventPublishingServiceDiscoveryFactory implements ServiceDiscoveryFactory { | ||
|
||
private static final Class<ServiceDiscoveryFactory> FACTORY_CLASS = ServiceDiscoveryFactory.class; | ||
|
||
@Override | ||
public ServiceDiscovery create(URL connectionURL) { | ||
String protocol = connectionURL.getProtocol(); | ||
ServiceDiscoveryFactory serviceDiscoveryFactory = loadFactoryByProtocol(protocol); | ||
ServiceDiscovery originalServiceDiscovery = serviceDiscoveryFactory.create(connectionURL); | ||
return new EventPublishingServiceDiscovery(originalServiceDiscovery); | ||
} | ||
|
||
protected ServiceDiscoveryFactory loadFactoryByProtocol(String protocol) { | ||
return getExtensionLoader(FACTORY_CLASS).getExtension(protocol); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...esources/META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscoveryFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
default=org.apache.dubbo.registry.client.DefaultServiceDiscoveryFactory | ||
event-publishing=org.apache.dubbo.registry.client.EventPublishingServiceDiscoveryFactory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...test/resources/META-INF/services/org.apache.dubbo.registry.client.ServiceDiscoveryFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
org.apache.dubbo.registry.client.InMemoryServiceDiscoveryFactory | ||
in-memory=org.apache.dubbo.registry.client.InMemoryServiceDiscoveryFactory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...esources/META-INF/dubbo/internal/org.apache.dubbo.registry.client.ServiceDiscoveryFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
zookeeper=org.apache.dubbo.registry.zookeeper.ZookeeperServiceDiscoveryFactory |