Skip to content

Commit 0562b64

Browse files
committed
Merge branch 'apache-3.2' into apache-3.3
# Conflicts: # dubbo-cluster/pom.xml # dubbo-dependencies-bom/pom.xml # dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java
2 parents 7696e1b + fa11b68 commit 0562b64

File tree

36 files changed

+303
-164
lines changed

36 files changed

+303
-164
lines changed

dubbo-cluster/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<description>The cluster module of dubbo project</description>
3030
<properties>
3131
<skip_maven_deploy>false</skip_maven_deploy>
32+
<nashorn-core.version>15.4</nashorn-core.version>
3233
</properties>
3334
<dependencies>
3435
<dependency>
@@ -86,5 +87,11 @@
8687
<version>${project.parent.version}</version>
8788
<optional>true</optional>
8889
</dependency>
90+
<dependency>
91+
<groupId>org.openjdk.nashorn</groupId>
92+
<artifactId>nashorn-core</artifactId>
93+
<version>${nashorn-core.version}</version>
94+
<scope>test</scope>
95+
</dependency>
8996
</dependencies>
9097
</project>

dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/serial/SerializingExecutor.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.apache.dubbo.common.threadlocal.InternalThreadLocalMap;
2727

2828
import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_ERROR_RUN_THREAD_TASK;
29+
import static org.apache.dubbo.common.utils.ExecutorUtil.isShutdown;
2930

3031
/**
3132
* Executor ensuring that all {@link Runnable} tasks submitted are executed in order
@@ -68,8 +69,10 @@ private void schedule(Runnable removable) {
6869
if (atomicBoolean.compareAndSet(false, true)) {
6970
boolean success = false;
7071
try {
71-
executor.execute(this);
72-
success = true;
72+
if (!isShutdown(executor)) {
73+
executor.execute(this);
74+
success = true;
75+
}
7376
} finally {
7477
// It is possible that at this point that there are still tasks in
7578
// the queue, it would be nice to keep trying but the error may not

dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/cached/CachedThreadPool.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.apache.dubbo.common.threadpool.ThreadPool;
2323
import org.apache.dubbo.common.threadpool.support.AbortPolicyWithReport;
2424

25+
import java.util.concurrent.BlockingQueue;
2526
import java.util.concurrent.Executor;
2627
import java.util.concurrent.LinkedBlockingQueue;
2728
import java.util.concurrent.SynchronousQueue;
@@ -53,10 +54,18 @@ public Executor getExecutor(URL url) {
5354
int threads = url.getParameter(THREADS_KEY, Integer.MAX_VALUE);
5455
int queues = url.getParameter(QUEUES_KEY, DEFAULT_QUEUES);
5556
int alive = url.getParameter(ALIVE_KEY, DEFAULT_ALIVE);
56-
return new ThreadPoolExecutor(cores, threads, alive, TimeUnit.MILLISECONDS,
57-
queues == 0 ? new SynchronousQueue<Runnable>() :
58-
(queues < 0 ? new MemorySafeLinkedBlockingQueue<Runnable>()
59-
: new LinkedBlockingQueue<Runnable>(queues)),
57+
58+
BlockingQueue<Runnable> blockingQueue;
59+
60+
if (queues == 0) {
61+
blockingQueue = new SynchronousQueue<>();
62+
} else if (queues < 0) {
63+
blockingQueue = new MemorySafeLinkedBlockingQueue<>();
64+
} else {
65+
blockingQueue = new LinkedBlockingQueue<>(queues);
66+
}
67+
68+
return new ThreadPoolExecutor(cores, threads, alive, TimeUnit.MILLISECONDS, blockingQueue,
6069
new NamedInternalThreadFactory(name, true), new AbortPolicyWithReport(name, url));
6170
}
6271
}

dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/limited/LimitedThreadPool.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.apache.dubbo.common.threadpool.ThreadPool;
2424
import org.apache.dubbo.common.threadpool.support.AbortPolicyWithReport;
2525

26+
import java.util.concurrent.BlockingQueue;
2627
import java.util.concurrent.Executor;
2728
import java.util.concurrent.LinkedBlockingQueue;
2829
import java.util.concurrent.SynchronousQueue;
@@ -50,10 +51,18 @@ public Executor getExecutor(URL url) {
5051
int cores = url.getParameter(CORE_THREADS_KEY, DEFAULT_CORE_THREADS);
5152
int threads = url.getParameter(THREADS_KEY, DEFAULT_THREADS);
5253
int queues = url.getParameter(QUEUES_KEY, DEFAULT_QUEUES);
53-
return new ThreadPoolExecutor(cores, threads, Long.MAX_VALUE, TimeUnit.MILLISECONDS,
54-
queues == 0 ? new SynchronousQueue<Runnable>() :
55-
(queues < 0 ? new MemorySafeLinkedBlockingQueue<Runnable>()
56-
: new LinkedBlockingQueue<Runnable>(queues)),
54+
55+
BlockingQueue<Runnable> blockingQueue;
56+
57+
if (queues == 0) {
58+
blockingQueue = new SynchronousQueue<>();
59+
} else if (queues < 0) {
60+
blockingQueue = new MemorySafeLinkedBlockingQueue<>();
61+
} else {
62+
blockingQueue = new LinkedBlockingQueue<>(queues);
63+
}
64+
65+
return new ThreadPoolExecutor(cores, threads, Long.MAX_VALUE, TimeUnit.MILLISECONDS, blockingQueue,
5766
new NamedInternalThreadFactory(name, true), new AbortPolicyWithReport(name, url));
5867
}
5968

dubbo-common/src/main/java/org/apache/dubbo/common/utils/ExecutorUtil.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,17 @@ public class ExecutorUtil {
3838
new NamedThreadFactory("Close-ExecutorService-Timer", true));
3939

4040
public static boolean isTerminated(Executor executor) {
41-
if (executor instanceof ExecutorService) {
42-
if (((ExecutorService) executor).isTerminated()) {
43-
return true;
44-
}
41+
if (!(executor instanceof ExecutorService)) {
42+
return false;
43+
}
44+
return ((ExecutorService) executor).isTerminated();
45+
}
46+
47+
public static boolean isShutdown(Executor executor) {
48+
if (!(executor instanceof ExecutorService)) {
49+
return false;
4550
}
46-
return false;
51+
return ((ExecutorService) executor).isShutdown();
4752
}
4853

4954
/**

dubbo-common/src/main/java/org/apache/dubbo/rpc/executor/AbstractIsolationExecutorSupport.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public AbstractIsolationExecutorSupport(URL url) {
3636
this.frameworkServiceRepository = url.getOrDefaultFrameworkModel().getServiceRepository();
3737
}
3838

39+
@Override
3940
public Executor getExecutor(Object data) {
4041

4142
ProviderModel providerModel = getProviderModel(data);

dubbo-common/src/main/java/org/apache/dubbo/rpc/executor/DefaultExecutorSupport.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public DefaultExecutorSupport(URL url) {
3030
this.executorRepository = ExecutorRepository.getInstance(url.getOrDefaultApplicationModel());
3131
}
3232

33+
@Override
3334
public Executor getExecutor(Object data) {
3435
return executorRepository.getExecutor(url);
3536
}

dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/LazyTargetInvocationHandler.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
4747
}
4848

4949
if (target == null) {
50-
synchronized (this) {
51-
if (target == null) {
52-
target = lazyTargetSource.getTarget();
53-
}
54-
}
50+
target = lazyTargetSource.getTarget();
5551
}
5652
if (method.getDeclaringClass().isInstance(target)) {
5753
try {

dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<properties>
3232
<skip_maven_deploy>true</skip_maven_deploy>
3333
<curator5_version>5.1.0</curator5_version>
34-
<zookeeper_version>3.8.1</zookeeper_version>
34+
<zookeeper_version>3.8.3</zookeeper_version>
3535
</properties>
3636

3737
<dependencies>

dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<properties>
3232
<skip_maven_deploy>true</skip_maven_deploy>
3333
<curator5_version>5.1.0</curator5_version>
34-
<zookeeper_version>3.8.1</zookeeper_version>
34+
<zookeeper_version>3.8.3</zookeeper_version>
3535
</properties>
3636

3737
<dependencies>

dubbo-demo/dubbo-demo-spring-boot/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<skip_maven_deploy>true</skip_maven_deploy>
3939
<spring-boot.version>2.7.16</spring-boot.version>
4040
<spring-boot-maven-plugin.version>2.7.16</spring-boot-maven-plugin.version>
41-
<micrometer-core.version>1.11.4</micrometer-core.version>
41+
<micrometer-core.version>1.11.5</micrometer-core.version>
4242
</properties>
4343
<dependencyManagement>
4444
<dependencies>

dubbo-dependencies-bom/pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
<spring_version>5.3.25</spring_version>
9595
<spring_security_version>5.8.7</spring_security_version>
9696
<javassist_version>3.29.2-GA</javassist_version>
97-
<bytebuddy.version>1.14.8</bytebuddy.version>
97+
<bytebuddy.version>1.14.9</bytebuddy.version>
9898
<netty_version>3.2.10.Final</netty_version>
9999
<netty4_version>4.1.99.Final</netty4_version>
100100
<mina_version>2.2.1</mina_version>
@@ -117,7 +117,7 @@
117117
<protobuf-java_version>3.24.4</protobuf-java_version>
118118
<javax_annotation-api_version>1.3.2</javax_annotation-api_version>
119119
<servlet_version>3.1.0</servlet_version>
120-
<jetty_version>9.4.52.v20230823</jetty_version>
120+
<jetty_version>9.4.53.v20231009</jetty_version>
121121
<validation_new_version>3.0.2</validation_new_version>
122122
<validation_version>1.1.0.Final</validation_version>
123123
<hibernate_validator_version>5.4.3.Final</hibernate_validator_version>
@@ -133,14 +133,14 @@
133133
<commons_lang3_version>3.12.0</commons_lang3_version>
134134
<protostuff_version>1.8.0</protostuff_version>
135135
<envoy_api_version>0.1.35</envoy_api_version>
136-
<micrometer.version>1.11.4</micrometer.version>
136+
<micrometer.version>1.11.5</micrometer.version>
137137
<opentelemetry.version>1.26.0</opentelemetry.version>
138138
<zipkin-reporter.version>2.16.4</zipkin-reporter.version>
139-
<micrometer-tracing.version>1.1.5</micrometer-tracing.version>
139+
<micrometer-tracing.version>1.1.6</micrometer-tracing.version>
140140
<t_digest.version>3.3</t_digest.version>
141141
<prometheus_client.version>0.16.0</prometheus_client.version>
142142
<reactive.version>1.0.4</reactive.version>
143-
<reactor.version>3.5.10</reactor.version>
143+
<reactor.version>3.5.11</reactor.version>
144144
<rxjava.version>2.2.21</rxjava.version>
145145
<okhttp_version>3.14.9</okhttp_version>
146146

@@ -187,7 +187,7 @@
187187
<metrics_version>2.0.6</metrics_version>
188188
<sofa_registry_version>5.4.3</sofa_registry_version>
189189
<gson_version>2.10.1</gson_version>
190-
<jackson_version>2.15.2</jackson_version>
190+
<jackson_version>2.15.3</jackson_version>
191191
<mortbay_jetty_version>6.1.26</mortbay_jetty_version>
192192
<portlet_version>2.0</portlet_version>
193193
<maven_flatten_version>1.5.0</maven_flatten_version>

dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/model/MetricsSupport.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.apache.dubbo.common.Version;
2121
import org.apache.dubbo.common.lang.Nullable;
2222
import org.apache.dubbo.common.utils.CollectionUtils;
23+
import org.apache.dubbo.common.utils.StringUtils;
2324
import org.apache.dubbo.metrics.collector.MethodMetricsCollector;
2425
import org.apache.dubbo.metrics.collector.ServiceMetricsCollector;
2526
import org.apache.dubbo.metrics.event.MetricsEvent;
@@ -32,10 +33,10 @@
3233
import org.apache.dubbo.rpc.RpcException;
3334
import org.apache.dubbo.rpc.model.ApplicationModel;
3435

35-
import java.util.HashMap;
3636
import java.util.Map;
37-
import java.util.Optional;
37+
import java.util.HashMap;
3838
import java.util.Set;
39+
import java.util.Optional;
3940
import java.util.concurrent.atomic.AtomicLong;
4041
import java.util.stream.Collectors;
4142

@@ -162,6 +163,9 @@ public static String getInterfaceName(Invocation invocation) {
162163
} else {
163164
String serviceUniqueName = invocation.getTargetServiceUniqueName();
164165
String interfaceAndVersion;
166+
if (StringUtils.isBlank(serviceUniqueName)) {
167+
return "";
168+
}
165169
String[] arr = serviceUniqueName.split(PATH_SEPARATOR);
166170
if (arr.length == 2) {
167171
interfaceAndVersion = arr[1];

dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/protocol/QosProtocolWrapper.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ public int getDefaultPort() {
7575

7676
@Override
7777
public <T> Exporter<T> export(Invoker<T> invoker) throws RpcException {
78-
startQosServer(invoker.getUrl());
78+
startQosServer(invoker.getUrl(), true);
7979
return protocol.export(invoker);
8080
}
8181

8282
@Override
8383
public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException {
84-
startQosServer(url);
84+
startQosServer(url, false);
8585
return protocol.refer(type, url);
8686
}
8787

@@ -96,7 +96,7 @@ public List<ProtocolServer> getServers() {
9696
return protocol.getServers();
9797
}
9898

99-
private void startQosServer(URL url) throws RpcException {
99+
private void startQosServer(URL url, boolean isServer) throws RpcException {
100100
boolean qosCheck = url.getParameter(QOS_CHECK, false);
101101

102102
try {
@@ -134,13 +134,18 @@ private void startQosServer(URL url) throws RpcException {
134134

135135
} catch (Throwable throwable) {
136136
logger.warn(QOS_FAILED_START_SERVER, "", "", "Fail to start qos server: ", throwable);
137-
try {
138-
stopServer();
139-
} catch (Throwable stop) {
140-
logger.warn(QOS_FAILED_START_SERVER, "", "", "Fail to stop qos server: ", stop);
141-
}
137+
142138
if (qosCheck) {
143-
throw new RpcException(throwable);
139+
try {
140+
// Stop QoS Server to support re-start if Qos-Check is enabled
141+
stopServer();
142+
} catch (Throwable stop) {
143+
logger.warn(QOS_FAILED_START_SERVER, "", "", "Fail to stop qos server: ", stop);
144+
}
145+
if (isServer) {
146+
// Only throws exception when export services
147+
throw new RpcException(throwable);
148+
}
144149
}
145150
}
146151
}

dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,6 @@ public interface Constants {
183183
String CONTENT_LENGTH_KEY = "content-length";
184184
String USE_SECURE_RANDOM_ID = "dubbo.application.use-secure-random-request-id";
185185

186+
String CONNECTION_HANDLER_NAME = "connectionHandler";
187+
186188
}

dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractClient.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,13 @@
4040
import static org.apache.dubbo.common.constants.CommonConstants.LAZY_CONNECT_KEY;
4141
import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_CLOSE;
4242
import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_CONNECT_PROVIDER;
43+
import static org.apache.dubbo.config.Constants.CLIENT_THREAD_POOL_NAME;
4344

4445
/**
4546
* AbstractClient
4647
*/
4748
public abstract class AbstractClient extends AbstractEndpoint implements Client {
4849

49-
protected static final String CLIENT_THREAD_POOL_NAME = "DubboClientHandler";
50-
5150
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(AbstractClient.class);
5251

5352
private final Lock connectLock = new ReentrantLock();

0 commit comments

Comments
 (0)