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

2.7.8 Dev #6386

Merged
merged 68 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
f608b21
Polish apache/dubbo#6296 : Adding the new methods into MetadataReport…
mercyblitz Jun 10, 2020
4e3c691
Polish apache/dubbo#6296 : Adding the new methods into MetadataReport…
mercyblitz Jun 10, 2020
e30a547
Polish apache/dubbo#6171 : [Feature] Introducing the composite implem…
mercyblitz Jun 10, 2020
351b439
Merge branch '2.7.8-dev' into 2.7.8-service-introspection
mercyblitz Jun 10, 2020
450c7cd
Revert "fix wrong check of InvokerListener when export a service (fix…
mercyblitz Jun 10, 2020
c39eeb5
Revert "fix wrong check of InvokerListener when export a service (fix…
mercyblitz Jun 10, 2020
e400898
Merge branch 'master' of github.com:apache/dubbo
mercyblitz Jun 10, 2020
0743042
Revert the MetadataReport
mercyblitz Jun 10, 2020
b48d7d6
Polish apache/dubbo#6305 : [Refactor] ServiceConfig and ReferenceConf…
mercyblitz Jun 11, 2020
6172dd9
Merge remote-tracking branch 'origin/2.7.8-service-introspection' int…
mercyblitz Jun 11, 2020
60c441d
Merge remote-tracking branch 'upstream/master' into 2.7.8-service-int…
mercyblitz Jun 11, 2020
38e0d33
Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#p…
mercyblitz Jun 11, 2020
a52ec0f
Polish apache/dubbo#6310 : Refactoring MetadataReport's methods
mercyblitz Jun 11, 2020
e2b9b56
Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#p…
mercyblitz Jun 11, 2020
ab03f26
Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#p…
mercyblitz Jun 11, 2020
55b95a7
Polish apache/dubbo#6315 : [Refactor] Refactoring the implementation …
mercyblitz Jun 12, 2020
454cea6
Polish apache/dubbo#6315 : Refactoring by TreePathDynamicConfiguration
mercyblitz Jun 12, 2020
2bdb538
Polish apache/dubbo#6315 : Refactoring ConsulDynamicConfiguration by …
mercyblitz Jun 12, 2020
2c92015
Polish apache/dubbo#6315 : Reset the config base path to be "metadata…
mercyblitz Jun 12, 2020
2fbc068
Polish apache/dubbo#6315 : Bugfix
mercyblitz Jun 12, 2020
ddc4cb7
Polish apache/dubbo#6315 : Bugfix
mercyblitz Jun 12, 2020
8a6a6bf
Merge remote-tracking branch 'upstream/2.7.8-dev' into 2.7.8-service-…
mercyblitz Jun 15, 2020
0154426
Merge remote-tracking branch 'upstream/2.7.8-dev' into 2.7.8-service-…
mercyblitz Jun 15, 2020
eba44fa
Polish apache/dubbo#6315 : Correct words
mercyblitz Jun 15, 2020
879a0c8
sync wait netty server to finish shutdown (#6281)
tswstarplanet Jun 15, 2020
c546f3c
Polish apache/dubbo#6333 : [Refactor] Using mandatory implementation …
mercyblitz Jun 16, 2020
c2d357b
maybe we can remove null judge in this case (#6321)
nineyang Jun 16, 2020
05e5c4f
Polish apache/dubbo#6336 : [Refactor] org.apache.dubbo.metadata.Servi…
mercyblitz Jun 17, 2020
719bad7
Merge remote-tracking branch 'upstream/2.7.8-dev' into 2.7.8-service-…
mercyblitz Jun 17, 2020
cac3c0d
Polish apache/dubbo#6170 : [Feature] Introducing the externalized con…
mercyblitz Jun 17, 2020
e72a3be
Polish apache/dubbo#6342 : [Enhancement] Introducing the composite Se…
mercyblitz Jun 18, 2020
64b474c
Refactor
mercyblitz Jun 18, 2020
3ef35a1
fix method name typo in JValidator.java (#6344)
Jun 18, 2020
c4f11fc
[Dubbo-6340]fix application cannot exit when use consul registry (#6341)
tswstarplanet Jun 18, 2020
1e51703
make consul registry suppor ACL (#6313)
tswstarplanet Jun 18, 2020
36e21ca
Polish apache/dubbo#6172 : [Feature] Adding the "services" attribute …
mercyblitz Jun 19, 2020
7b03172
Polish apache/dubbo#6173 : [Feature] Adding the "services" attribute …
mercyblitz Jun 19, 2020
1b12937
Polish apache/dubbo#6346 : [Issue] Merging all subscribied URLs from …
mercyblitz Jun 19, 2020
77c82d4
Polish apache/dubbo#6346 : [Issue] Merging all subscribied URLs from …
mercyblitz Jun 19, 2020
5230444
fix publish null value when use consul config center (#6351)
tswstarplanet Jun 20, 2020
e528d75
Polish apache/dubbo#6252
mercyblitz Jun 22, 2020
f4a02de
Polish apache/dubbo#6356 & apache/dubbo#6171
mercyblitz Jun 23, 2020
3be5aa2
Polish apache/dubbo#6356 & apache/dubbo#6171
mercyblitz Jun 23, 2020
0014485
Polish apache/dubbo#6224 : Filter chain was not invoked with local ca…
mercyblitz Jun 23, 2020
6f78b4d
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 23, 2020
74777d8
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 24, 2020
cd974c4
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 24, 2020
c4ca993
Merge remote-tracking branch 'upstream/2.7.8-dev' into 2.7.8-service-…
mercyblitz Jun 24, 2020
cb2e421
Polish apache/dubbo#6322 : Adding META-INF/dubbo/internal/org.apache.…
mercyblitz Jun 24, 2020
b8b42b1
fix the priority of ListenableRouter were not effective (#6148)
luoning810 Jun 24, 2020
32c55aa
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 24, 2020
6478ac9
when the url is generic, the log level should be info (#6363)
cvictory Jun 24, 2020
69cd83d
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 28, 2020
74e378b
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 28, 2020
f24d7dd
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 28, 2020
275caec
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 28, 2020
7447f33
fix NPE when check=false is set and provider is empty. (#6376)
chickenlj Jun 28, 2020
ec6a169
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 29, 2020
a03aaf0
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 29, 2020
cddd02b
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 29, 2020
08f5029
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 29, 2020
80acc24
fix #6306. support TypeBuilder sort (#6365)
cvictory Jun 29, 2020
9804107
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 29, 2020
e0d031e
enhance ClusterInvoker & ExtensionLoader (#6343)
chickenlj Jun 29, 2020
9c1f4c0
Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases…
mercyblitz Jun 29, 2020
f9796c9
Merge remote-tracking branch 'upstream/master' into 2.7.8-service-int…
mercyblitz Jun 30, 2020
d6409ac
Fixed the test-cases
mercyblitz Jun 30, 2020
83a71fd
Merge branch '2.7.8-dev' into 2.7.8-service-introspection
mercyblitz Jun 30, 2020
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
8 changes: 8 additions & 0 deletions dubbo-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,14 @@
</resource>
</transformer>

<!-- @since 2.7.8 -->
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>
META-INF/dubbo/internal/org.apache.dubbo.metadata.MetadataServiceExporter
</resource>
</transformer>

</transformers>
<filters>
<filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
package org.apache.dubbo.rpc.cluster;

import org.apache.dubbo.common.extension.Adaptive;
import org.apache.dubbo.common.extension.ExtensionLoader;
import org.apache.dubbo.common.extension.SPI;
import org.apache.dubbo.common.utils.StringUtils;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.cluster.support.FailoverCluster;
Expand All @@ -29,8 +31,9 @@
* <a href="http://en.wikipedia.org/wiki/Fault-tolerant_system">Fault-Tolerant</a>
*
*/
@SPI(FailoverCluster.NAME)
@SPI(Cluster.DEFAULT)
public interface Cluster {
String DEFAULT = FailoverCluster.NAME;

/**
* Merge the directory invokers to a virtual invoker.
Expand All @@ -43,4 +46,14 @@ public interface Cluster {
@Adaptive
<T> Invoker<T> join(Directory<T> directory) throws RpcException;

static Cluster getCluster(String name) {
return getCluster(name, true);
}

static Cluster getCluster(String name, boolean wrap) {
if (StringUtils.isEmpty(name)) {
name = Cluster.DEFAULT;
}
return ExtensionLoader.getExtensionLoader(Cluster.class).getExtension(name, wrap);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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.
*/
package org.apache.dubbo.rpc.cluster;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.Invoker;

/**
* This is the final Invoker type referenced by the RPC proxy on Consumer side.
* <p>
* A ClusterInvoker holds a group of normal invokers, stored in a Directory, mapping to one Registry.
* The ClusterInvoker implementation usually provides LB or HA policies, like FailoverClusterInvoker.
* <p>
* In multi-registry subscription scenario, the final ClusterInvoker will referr to several sub ClusterInvokers, with each
* sub ClusterInvoker representing one Registry. Take ZoneAwareClusterInvoker as an example, it is specially customized for
* multi-registry use cases: first, pick up one ClusterInvoker, then do LB inside the chose ClusterInvoker.
*
* @param <T>
*/
public interface ClusterInvoker<T> extends Invoker<T> {
URL getRegistryUrl();

Directory<T> getDirectory();
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ public AbstractDirectory(URL url, RouterChain<T> routerChain) {
}

this.url = url.removeParameter(REFER_KEY).removeParameter(MONITOR_KEY);
this.consumerUrl = url.addParameters(StringUtils.parseQueryString(url.getParameterAndDecoded(REFER_KEY)))
.removeParameter(MONITOR_KEY);
this.consumerUrl = this.url.addParameters(StringUtils.parseQueryString(url.getParameterAndDecoded(REFER_KEY)));

setRouterChain(routerChain);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation

@Override
public int getPriority() {
return DEFAULT_PRIORITY;
return priority;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class MockInvokersSelector extends AbstractRouter {

public static final String NAME = "MOCK_ROUTER";
private static final int MOCK_INVOKERS_DEFAULT_PRIORITY = Integer.MIN_VALUE;
private static final int MOCK_INVOKERS_DEFAULT_PRIORITY = -100;

public MockInvokersSelector() {
this.priority = MOCK_INVOKERS_DEFAULT_PRIORITY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.dubbo.rpc.RpcContext;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.RpcInvocation;
import org.apache.dubbo.rpc.cluster.ClusterInvoker;
import org.apache.dubbo.rpc.cluster.Directory;
import org.apache.dubbo.rpc.cluster.LoadBalance;
import org.apache.dubbo.rpc.support.RpcUtils;
Expand All @@ -49,7 +50,7 @@
/**
* AbstractClusterInvoker
*/
public abstract class AbstractClusterInvoker<T> implements Invoker<T> {
public abstract class AbstractClusterInvoker<T> implements ClusterInvoker<T> {

private static final Logger logger = LoggerFactory.getLogger(AbstractClusterInvoker.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.Result;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.cluster.ClusterInvoker;
import org.apache.dubbo.rpc.cluster.Directory;
import org.apache.dubbo.rpc.cluster.LoadBalance;
import org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker;
Expand Down Expand Up @@ -59,24 +60,23 @@ public ZoneAwareClusterInvoker(Directory<T> directory) {
public Result doInvoke(Invocation invocation, final List<Invoker<T>> invokers, LoadBalance loadbalance) throws RpcException {
// First, pick the invoker (XXXClusterInvoker) that comes from the local registry, distinguish by a 'preferred' key.
for (Invoker<T> invoker : invokers) {
// FIXME, the invoker is a cluster invoker representing one Registry, so it will automatically wrapped by MockClusterInvoker.
MockClusterInvoker<T> mockClusterInvoker = (MockClusterInvoker<T>) invoker;
if (mockClusterInvoker.isAvailable() && mockClusterInvoker.getRegistryUrl()
ClusterInvoker<T> clusterInvoker = (ClusterInvoker<T>) invoker;
if (clusterInvoker.isAvailable() && clusterInvoker.getRegistryUrl()
.getParameter(REGISTRY_KEY + "." + PREFERRED_KEY, false)) {
return mockClusterInvoker.invoke(invocation);
return clusterInvoker.invoke(invocation);
}
}

// providers in the registry with the same zone
String zone = (String) invocation.getAttachment(REGISTRY_ZONE);
String zone = invocation.getAttachment(REGISTRY_ZONE);
if (StringUtils.isNotEmpty(zone)) {
for (Invoker<T> invoker : invokers) {
MockClusterInvoker<T> mockClusterInvoker = (MockClusterInvoker<T>) invoker;
if (mockClusterInvoker.isAvailable() && zone.equals(mockClusterInvoker.getRegistryUrl().getParameter(REGISTRY_KEY + "." + ZONE_KEY))) {
return mockClusterInvoker.invoke(invocation);
ClusterInvoker<T> clusterInvoker = (ClusterInvoker<T>) invoker;
if (clusterInvoker.isAvailable() && zone.equals(clusterInvoker.getRegistryUrl().getParameter(REGISTRY_KEY + "." + ZONE_KEY))) {
return clusterInvoker.invoke(invocation);
}
}
String force = (String) invocation.getAttachment(REGISTRY_ZONE_FORCE);
String force = invocation.getAttachment(REGISTRY_ZONE_FORCE);
if (StringUtils.isNotEmpty(force) && "true".equalsIgnoreCase(force)) {
throw new IllegalStateException("No registry instance in zone or no available providers in the registry, zone: "
+ zone
Expand All @@ -93,12 +93,14 @@ public Result doInvoke(Invocation invocation, final List<Invoker<T>> invokers, L

// If none of the invokers has a preferred signal or is picked by the loadbalancer, pick the first one available.
for (Invoker<T> invoker : invokers) {
MockClusterInvoker<T> mockClusterInvoker = (MockClusterInvoker<T>) invoker;
if (mockClusterInvoker.isAvailable()) {
return mockClusterInvoker.invoke(invocation);
ClusterInvoker<T> clusterInvoker = (ClusterInvoker<T>) invoker;
if (clusterInvoker.isAvailable()) {
return clusterInvoker.invoke(invocation);
}
}
throw new RpcException("No provider available in " + invokers);

//if none available,just pick one
return invokers.get(0).invoke(invocation);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.dubbo.rpc.Result;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.RpcInvocation;
import org.apache.dubbo.rpc.cluster.ClusterInvoker;
import org.apache.dubbo.rpc.cluster.Directory;
import org.apache.dubbo.rpc.support.MockInvoker;

Expand All @@ -35,7 +36,7 @@
import static org.apache.dubbo.rpc.Constants.MOCK_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.INVOCATION_NEED_MOCK;

public class MockClusterInvoker<T> implements Invoker<T> {
public class MockClusterInvoker<T> implements ClusterInvoker<T> {

private static final Logger logger = LoggerFactory.getLogger(MockClusterInvoker.class);

Expand All @@ -57,6 +58,11 @@ public URL getRegistryUrl() {
return directory.getUrl();
}

@Override
public Directory<T> getDirectory() {
return directory;
}

@Override
public boolean isAvailable() {
return directory.isAvailable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void testSelect_multiInvokers() throws Exception {
public void testCloseAvailablecheck() {
LoadBalance lb = mock(LoadBalance.class);
Map<String, String> queryMap = StringUtils.parseQueryString(url.getParameterAndDecoded(REFER_KEY));
URL tmpUrl = url.addParameters(queryMap).removeParameter(MONITOR_KEY);
URL tmpUrl = url.addParameters(queryMap).removeParameter(REFER_KEY).removeParameter(MONITOR_KEY);
given(lb.select(invokers, tmpUrl, invocation)).willReturn(invoker1);
initlistsize5();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ protected ThreadPoolExecutor initWorkersThreadPool(String threadPoolPrefixName,
int threadPoolSize,
long keepAliveTime) {
return new ThreadPoolExecutor(threadPoolSize, threadPoolSize, keepAliveTime,
TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory(threadPoolPrefixName));
TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory(threadPoolPrefixName, true));
}

protected static String getThreadPoolPrefixName(URL url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.dubbo.common.config.configcenter.TreePathDynamicConfiguration;
import org.apache.dubbo.common.function.ThrowableConsumer;
import org.apache.dubbo.common.function.ThrowableFunction;
import org.apache.dubbo.common.lang.ShutdownHookCallbacks;
import org.apache.dubbo.common.utils.NamedThreadFactory;
import org.apache.dubbo.common.utils.StringUtils;

Expand Down Expand Up @@ -146,6 +147,7 @@ public class FileSystemDynamicConfiguration extends TreePathDynamicConfiguration
MODIFIERS = initWatchEventModifiers();
DELAY = initDelay(MODIFIERS);
WATCH_EVENTS_LOOP_THREAD_POOL = newWatchEventsLoopThreadPool();
registerDubboShutdownHook();
}

/**
Expand Down Expand Up @@ -230,6 +232,24 @@ private void doInListener(String configFilePath, BiConsumer<File, List<Configura
});
}

/**
* Register the Dubbo ShutdownHook
*
* @since 2.7.8
*/
private static void registerDubboShutdownHook() {
ShutdownHookCallbacks.INSTANCE.addCallback(() -> {
watchService.ifPresent(w -> {
try {
w.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
});
getWatchEventsLoopThreadPool().shutdown();
});
}

private static boolean isProcessingWatchEvents() {
return getWatchEventsLoopThreadPool().getActiveCount() > 0;
}
Expand Down
Loading