mirror of
https://github.com/apache/rocketmq.git
synced 2026-09-21 05:44:03 +08:00
[ISSUE #3949] improve readability.
This commit is contained in:
@@ -80,18 +80,18 @@ public class ProxyStartup {
|
||||
try {
|
||||
PROXY_START_AND_SHUTDOWN.shutdown();
|
||||
} catch (Exception e) {
|
||||
log.error("err when shutdown rmq-proxy", e);
|
||||
log.error("err when shutdown rocketmq-proxy", e);
|
||||
}
|
||||
}));
|
||||
} catch (Exception e) {
|
||||
System.err.println("find a unexpect err." + e);
|
||||
System.err.println("find an unexpect err." + e);
|
||||
e.printStackTrace();
|
||||
log.error("find a unexpect err.", e);
|
||||
log.error("find an unexpect err.", e);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
System.out.printf("%s%n", new Date() + " rmq-proxy startup successfully");
|
||||
log.info(new Date() + " rmq-proxy startup successfully");
|
||||
System.out.printf("%s%n", new Date() + " rocketmq-proxy startup successfully");
|
||||
log.info(new Date() + " rocketmq-proxy startup successfully");
|
||||
}
|
||||
|
||||
private static MessagingProcessor createMessagingProcessor() {
|
||||
@@ -134,8 +134,9 @@ public class ProxyStartup {
|
||||
}
|
||||
|
||||
public static ThreadPoolExecutor createServerExecutor() {
|
||||
int threadPoolNums = ConfigurationManager.getProxyConfig().getGrpcThreadPoolNums();
|
||||
int threadPoolQueueCapacity = ConfigurationManager.getProxyConfig().getGrpcThreadPoolQueueCapacity();
|
||||
ProxyConfig config = ConfigurationManager.getProxyConfig();
|
||||
int threadPoolNums = config.getGrpcThreadPoolNums();
|
||||
int threadPoolQueueCapacity = config.getGrpcThreadPoolQueueCapacity();
|
||||
ThreadPoolExecutor executor = ThreadPoolMonitor.createAndMonitor(
|
||||
threadPoolNums,
|
||||
threadPoolNums,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.rocketmq.proxy.config;
|
||||
|
||||
import java.time.Duration;
|
||||
import org.apache.rocketmq.proxy.ProxyMode;
|
||||
|
||||
public class ProxyConfig {
|
||||
@@ -29,7 +30,7 @@ public class ProxyConfig {
|
||||
* configuration for ThreadPoolMonitor
|
||||
*/
|
||||
private boolean enablePrintJstack = true;
|
||||
private long printJstackInMillis = 60000;
|
||||
private long printJstackInMillis = Duration.ofSeconds(60).toMillis();
|
||||
|
||||
private String nameSrvAddr = "";
|
||||
private String nameSrvDomain = "";
|
||||
@@ -58,7 +59,7 @@ public class ProxyConfig {
|
||||
|
||||
private int rocketmqMQClientNum = 6;
|
||||
|
||||
private long grpcProxyOutRequestTimeoutSecond = 5;
|
||||
private long grpcProxyRelayRequestTimeoutInSeconds = 5;
|
||||
private int grpcProducerThreadPoolNums = PROCESSOR_NUMBER;
|
||||
private int grpcProducerThreadQueueCapacity = 10000;
|
||||
private int grpcConsumerThreadPoolNums = PROCESSOR_NUMBER;
|
||||
@@ -258,12 +259,12 @@ public class ProxyConfig {
|
||||
this.rocketmqMQClientNum = rocketmqMQClientNum;
|
||||
}
|
||||
|
||||
public long getGrpcProxyOutRequestTimeoutSecond() {
|
||||
return grpcProxyOutRequestTimeoutSecond;
|
||||
public long getGrpcProxyRelayRequestTimeoutInSeconds() {
|
||||
return grpcProxyRelayRequestTimeoutInSeconds;
|
||||
}
|
||||
|
||||
public void setGrpcProxyOutRequestTimeoutSecond(long grpcProxyOutRequestTimeoutSecond) {
|
||||
this.grpcProxyOutRequestTimeoutSecond = grpcProxyOutRequestTimeoutSecond;
|
||||
public void setGrpcProxyRelayRequestTimeoutInSeconds(long grpcProxyRelayRequestTimeoutInSeconds) {
|
||||
this.grpcProxyRelayRequestTimeoutInSeconds = grpcProxyRelayRequestTimeoutInSeconds;
|
||||
}
|
||||
|
||||
public int getGrpcProducerThreadPoolNums() {
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ public class GrpcChannelManager implements StartAndShutdown {
|
||||
|
||||
protected void scanExpireResultFuture() {
|
||||
ProxyConfig proxyConfig = ConfigurationManager.getProxyConfig();
|
||||
long timeOutMs = TimeUnit.SECONDS.toMillis(proxyConfig.getGrpcProxyOutRequestTimeoutSecond());
|
||||
long timeOutMs = TimeUnit.SECONDS.toMillis(proxyConfig.getGrpcProxyRelayRequestTimeoutInSeconds());
|
||||
|
||||
Set<String> nonceSet = this.resultNonceFutureMap.keySet();
|
||||
for (String nonce : nonceSet) {
|
||||
|
||||
Reference in New Issue
Block a user