You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2021/07/07 14:50:27 UTC
[shardingsphere] branch master updated: Avoid use String.format to
enhance the performance (#11205)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new a0adcb7 Avoid use String.format to enhance the performance (#11205)
a0adcb7 is described below
commit a0adcb72a9121bf74e4c4e80a68c605a4aff4753
Author: Liang Zhang <te...@163.com>
AuthorDate: Wed Jul 7 22:49:45 2021 +0800
Avoid use String.format to enhance the performance (#11205)
---
.../metrics/prometheus/service/PrometheusPluginBootService.java | 7 ++++---
.../infra/binder/statement/dml/SelectStatementContext.java | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/service/PrometheusPluginBootService.java b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/service/PrometheusPluginBootService.java
index a0c15b3..55e05f9 100644
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/service/PrometheusPluginBootService.java
+++ b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/service/PrometheusPluginBootService.java
@@ -20,8 +20,6 @@ package org.apache.shardingsphere.agent.metrics.prometheus.service;
import io.prometheus.client.CollectorRegistry;
import io.prometheus.client.exporter.HTTPServer;
import io.prometheus.client.hotspot.DefaultExports;
-import java.io.IOException;
-import java.net.InetSocketAddress;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.agent.config.PluginConfiguration;
import org.apache.shardingsphere.agent.exception.PluginConfigurationException;
@@ -30,6 +28,9 @@ import org.apache.shardingsphere.agent.metrics.prometheus.collector.BuildInfoCol
import org.apache.shardingsphere.agent.metrics.prometheus.register.PrometheusMetricsRegister;
import org.apache.shardingsphere.agent.spi.boot.PluginBootService;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+
/**
* Prometheus plugin boot service.
*/
@@ -76,7 +77,7 @@ public final class PrometheusPluginBootService implements PluginBootService {
}
try {
httpServer = new HTTPServer(inetSocketAddress, CollectorRegistry.defaultRegistry, true);
- log.info(String.format("Prometheus metrics HTTP server `%s:%s` start success.", inetSocketAddress.getHostString(), inetSocketAddress.getPort()));
+ log.info("Prometheus metrics HTTP server `{}:{}` start success.", inetSocketAddress.getHostString(), inetSocketAddress.getPort());
} catch (final IOException ex) {
log.error("Prometheus metrics HTTP server start fail", ex);
}
diff --git a/shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/statement/dml/SelectStatementContext.java b/shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/statement/dml/SelectStatementContext.java
index 187d986..9671b5e 100644
--- a/shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/statement/dml/SelectStatementContext.java
+++ b/shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/statement/dml/SelectStatementContext.java
@@ -113,7 +113,7 @@ public final class SelectStatementContext extends CommonSQLStatementContext<Sele
private ShardingSphereSchema getSchema(final Map<String, ShardingSphereMetaData> metaDataMap, final String defaultSchemaName) {
String schemaName = tablesContext.getSchemaName().orElse(defaultSchemaName);
ShardingSphereMetaData metaData = metaDataMap.get(schemaName);
- Preconditions.checkState(null != metaData, String.format("Can not get metaData by schemaName [%s].", schemaName));
+ Preconditions.checkState(null != metaData, "Can not get meta data by schema mame `%s`.", schemaName);
return metaData.getSchema();
}