This is an automated email from the ASF dual-hosted git repository.

chenjiahao 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 a50bc808753 Remove Gson from DistSQL example. (#28260)
a50bc808753 is described below

commit a50bc808753ad70e7ec4b477451c87024e25014c
Author: Raigor <[email protected]>
AuthorDate: Fri Aug 25 19:20:15 2023 +0800

    Remove Gson from DistSQL example. (#28260)
---
 .../example/proxy/distsql/feature/encrypt/EncryptExecutor.java |  6 +++---
 .../feature/readwritesplitting/ReadWriteSplittingExecutor.java |  6 +++---
 .../proxy/distsql/feature/resource/ResourceExecutor.java       |  6 +++---
 .../example/proxy/distsql/feature/shadow/ShadowExecutor.java   | 10 +++++-----
 .../proxy/distsql/feature/sharding/ShardingExecutor.java       | 10 +++++-----
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git 
a/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/encrypt/EncryptExecutor.java
 
b/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/encrypt/EncryptExecutor.java
index 6bb35bc232d..0f663da4bc0 100644
--- 
a/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/encrypt/EncryptExecutor.java
+++ 
b/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/encrypt/EncryptExecutor.java
@@ -17,9 +17,9 @@
 
 package org.apache.shardingsphere.example.proxy.distsql.feature.encrypt;
 
-import com.google.gson.Gson;
 import lombok.extern.slf4j.Slf4j;
 import 
org.apache.shardingsphere.example.proxy.distsql.feature.AbstractFeatureExecutor;
+import org.apache.shardingsphere.infra.util.json.JsonUtils;
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -58,7 +58,7 @@ public final class EncryptExecutor extends 
AbstractFeatureExecutor {
     }
     
     @Override
-    public void execute() throws SQLException, InterruptedException {
+    public void execute() throws SQLException {
         executeUseSchema();
         executeShowRule();
         executeAddRule();
@@ -72,7 +72,7 @@ public final class EncryptExecutor extends 
AbstractFeatureExecutor {
     private void executeShowRule() throws SQLException {
         log.info("show rule...");
         ResultSet resultSet = statement.executeQuery(SHOW_RULE);
-        log.info(new Gson().toJson(getResultData(resultSet)));
+        log.info(JsonUtils.toJsonString(getResultData(resultSet)));
     }
     
     private void executeAddRule() throws SQLException {
diff --git 
a/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/readwritesplitting/ReadWriteSplittingExecutor.java
 
b/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/readwritesplitting/ReadWriteSplittingExecutor.java
index 65b65123a50..44f39b80773 100644
--- 
a/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/readwritesplitting/ReadWriteSplittingExecutor.java
+++ 
b/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/readwritesplitting/ReadWriteSplittingExecutor.java
@@ -17,9 +17,9 @@
 
 package 
org.apache.shardingsphere.example.proxy.distsql.feature.readwritesplitting;
 
-import com.google.gson.Gson;
 import lombok.extern.slf4j.Slf4j;
 import 
org.apache.shardingsphere.example.proxy.distsql.feature.AbstractFeatureExecutor;
+import org.apache.shardingsphere.infra.util.json.JsonUtils;
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -53,7 +53,7 @@ public final class ReadWriteSplittingExecutor extends 
AbstractFeatureExecutor {
     }
     
     @Override
-    public void execute() throws SQLException, InterruptedException {
+    public void execute() throws SQLException {
         executeUseSchema();
         executeShowRule();
         executeAddRule();
@@ -67,7 +67,7 @@ public final class ReadWriteSplittingExecutor extends 
AbstractFeatureExecutor {
     private void executeShowRule() throws SQLException {
         log.info("show rule...");
         ResultSet resultSet = statement.executeQuery(SHOW_RULE);
-        log.info(new Gson().toJson(getResultData(resultSet)));
+        log.info(JsonUtils.toJsonString(getResultData(resultSet)));
     }
     
     private void executeAddRule() throws SQLException {
diff --git 
a/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/resource/ResourceExecutor.java
 
b/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/resource/ResourceExecutor.java
index 7cfa763c27b..38cac8f2635 100644
--- 
a/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/resource/ResourceExecutor.java
+++ 
b/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/resource/ResourceExecutor.java
@@ -17,9 +17,9 @@
 
 package org.apache.shardingsphere.example.proxy.distsql.feature.resource;
 
-import com.google.gson.Gson;
 import lombok.extern.slf4j.Slf4j;
 import 
org.apache.shardingsphere.example.proxy.distsql.feature.AbstractFeatureExecutor;
+import org.apache.shardingsphere.infra.util.json.JsonUtils;
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -61,7 +61,7 @@ public final class ResourceExecutor extends 
AbstractFeatureExecutor {
     }
     
     @Override
-    public void execute() throws SQLException, InterruptedException {
+    public void execute() throws SQLException {
         executeUseSchema();
         executeShowResources();
         executeAddResource();
@@ -75,7 +75,7 @@ public final class ResourceExecutor extends 
AbstractFeatureExecutor {
     private void executeShowResources() throws SQLException {
         log.info("show schema resources...");
         ResultSet resultSet = statement.executeQuery(SHOW_RESOURCE);
-        log.info(new Gson().toJson(getResultData(resultSet)));
+        log.info(JsonUtils.toJsonString(getResultData(resultSet)));
     }
     
     private void executeAddResource() throws SQLException {
diff --git 
a/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/shadow/ShadowExecutor.java
 
b/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/shadow/ShadowExecutor.java
index 8b4d0fd67b9..f501717f1ab 100644
--- 
a/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/shadow/ShadowExecutor.java
+++ 
b/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/shadow/ShadowExecutor.java
@@ -17,9 +17,9 @@
 
 package org.apache.shardingsphere.example.proxy.distsql.feature.shadow;
 
-import com.google.gson.Gson;
 import lombok.extern.slf4j.Slf4j;
 import 
org.apache.shardingsphere.example.proxy.distsql.feature.AbstractFeatureExecutor;
+import org.apache.shardingsphere.infra.util.json.JsonUtils;
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -59,7 +59,7 @@ public final class ShadowExecutor extends 
AbstractFeatureExecutor {
     }
     
     @Override
-    public void execute() throws SQLException, InterruptedException {
+    public void execute() throws SQLException {
         executeUseSchema();
         executeShowRule();
         executeAddRule();
@@ -80,19 +80,19 @@ public final class ShadowExecutor extends 
AbstractFeatureExecutor {
     private void executeShowRule() throws SQLException {
         log.info("show rule...");
         ResultSet resultSet = statement.executeQuery(SHOW_RULE);
-        log.info(new Gson().toJson(getResultData(resultSet)));
+        log.info(JsonUtils.toJsonString(getResultData(resultSet)));
     }
     
     private void executeShowTableRule() throws SQLException {
         log.info("show table rule...");
         ResultSet resultSet = statement.executeQuery(SHOW_TABLE_RULE);
-        log.info(new Gson().toJson(getResultData(resultSet)));
+        log.info(JsonUtils.toJsonString(getResultData(resultSet)));
     }
     
     private void executeShowAlgorithm() throws SQLException {
         log.info("show algorithm...");
         ResultSet resultSet = statement.executeQuery(SHOW_ALGORITHM);
-        log.info(new Gson().toJson(getResultData(resultSet)));
+        log.info(JsonUtils.toJsonString(getResultData(resultSet)));
     }
     
     private void executeAddRule() throws SQLException {
diff --git 
a/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/sharding/ShardingExecutor.java
 
b/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/sharding/ShardingExecutor.java
index ef09dec8cb8..0fa6284fd4d 100644
--- 
a/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/sharding/ShardingExecutor.java
+++ 
b/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/feature/sharding/ShardingExecutor.java
@@ -17,9 +17,9 @@
 
 package org.apache.shardingsphere.example.proxy.distsql.feature.sharding;
 
-import com.google.gson.Gson;
 import lombok.extern.slf4j.Slf4j;
 import 
org.apache.shardingsphere.example.proxy.distsql.feature.AbstractFeatureExecutor;
+import org.apache.shardingsphere.infra.util.json.JsonUtils;
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -63,7 +63,7 @@ public final class ShardingExecutor extends 
AbstractFeatureExecutor {
     }
     
     @Override
-    public void execute() throws SQLException, InterruptedException {
+    public void execute() throws SQLException {
         executeUseSchema();
         executeShowRule();
         executeAddRule();
@@ -84,13 +84,13 @@ public final class ShardingExecutor extends 
AbstractFeatureExecutor {
     private void executeShowRule() throws SQLException {
         log.info("show rule...");
         ResultSet resultSet = statement.executeQuery(SHOW_RULE);
-        log.info(new Gson().toJson(getResultData(resultSet)));
+        log.info(JsonUtils.toJsonString(getResultData(resultSet)));
     }
     
     private void executeShowAlgorithm() throws SQLException {
         log.info("show algorithm...");
         ResultSet resultSet = statement.executeQuery(SHOW_ALGORITHM);
-        log.info(new Gson().toJson(getResultData(resultSet)));
+        log.info(JsonUtils.toJsonString(getResultData(resultSet)));
     }
     
     private void executeAddRule() throws SQLException {
@@ -116,7 +116,7 @@ public final class ShardingExecutor extends 
AbstractFeatureExecutor {
     private void executeShowKeyGenerators() throws SQLException {
         log.info("show sharding key generators...");
         ResultSet resultSet = statement.executeQuery(SHOW_KEY_GENERATORS);
-        log.info(new Gson().toJson(getResultData(resultSet)));
+        log.info(JsonUtils.toJsonString(getResultData(resultSet)));
     }
     
     private void executeDropKeyGenerator() throws SQLException {

Reply via email to