You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ki...@apache.org on 2020/07/28 07:45:15 UTC
[shardingsphere] branch master updated: just format some code and
update some java doc. (#6487)
This is an automated email from the ASF dual-hosted git repository.
kimmking 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 4894291 just format some code and update some java doc. (#6487)
4894291 is described below
commit 4894291f019e8518dd07a2377861226c0aca7707
Author: 邱鹿 Lucas <lu...@163.com>
AuthorDate: Tue Jul 28 15:44:48 2020 +0800
just format some code and update some java doc. (#6487)
* format code.
* format code.
* merger from master.
Co-authored-by: qiulu3 <Lucas209910>
---
.../row/column/value/string/MySQLJsonBinlogProtocolValue.java | 1 -
.../org/apache/shardingsphere/scaling/web/HttpServerHandler.java | 4 ++--
.../scaling/core/execute/executor/dumper/AbstractJDBCDumper.java | 4 ++--
.../job/position/resume/ZookeeperResumablePositionManager.java | 6 +-----
.../core/job/preparer/checker/AbstractDataSourceChecker.java | 4 ++--
.../core/job/preparer/splitter/InventoryDataTaskSplitter.java | 4 ++--
.../core/job/task/incremental/IncrementalDataScalingTask.java | 4 ++--
.../scaling/core/job/task/inventory/InventoryDataScalingTask.java | 8 ++++----
.../shardingsphere/scaling/core/metadata/MetaDataManager.java | 4 ++--
.../shardingsphere/scaling/mysql/MySQLDataSourceChecker.java | 8 ++++----
.../apache/shardingsphere/scaling/mysql/client/MySQLClient.java | 4 ++--
.../scaling/postgresql/PostgreSQLDataSourceChecker.java | 4 ++--
.../scaling/postgresql/PostgreSQLPositionManager.java | 4 ++--
.../scaling/postgresql/wal/decode/TestDecodingPlugin.java | 8 ++++----
.../sql/parser/binder/metadata/MetaDataConnection.java | 4 ++--
.../xa/narayana/manager/DataSourceXAResourceRecoveryHelper.java | 4 ++--
16 files changed, 35 insertions(+), 40 deletions(-)
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValue.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValue.java
index 9c91b1d..692dc85 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValue.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonBinlogProtocolValue.java
@@ -34,7 +34,6 @@ import java.io.Serializable;
* </p>
*
* @see <a href="https://github.com/mysql/mysql-server/blob/5.7/sql/json_binary.h">json_binary</a>
- * @see <a href="https://github.com/apache/shardingsphere/issues/4795"></a>
*/
public final class MySQLJsonBinlogProtocolValue implements MySQLBinlogProtocolValue {
diff --git a/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/main/java/org/apache/shardingsphere/scaling/web/HttpServerHandler.java b/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/main/java/org/apache/shardingsphere/scaling/web/HttpServerHandler.java
index 10902ee..2cfc8b9 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/main/java/org/apache/shardingsphere/scaling/web/HttpServerHandler.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/main/java/org/apache/shardingsphere/scaling/web/HttpServerHandler.java
@@ -100,8 +100,8 @@ public final class HttpServerHandler extends SimpleChannelInboundHandler<FullHtt
try {
SyncProgress progresses = SCALING_JOB_CONTROLLER.getProgresses(jobId);
response(GSON.toJson(ResponseContentUtil.build(progresses)), channelHandlerContext, HttpResponseStatus.OK);
- } catch (ScalingJobNotFoundException e) {
- response(GSON.toJson(ResponseContentUtil.handleBadRequest(e.getMessage())), channelHandlerContext, HttpResponseStatus.BAD_REQUEST);
+ } catch (ScalingJobNotFoundException ex) {
+ response(GSON.toJson(ResponseContentUtil.handleBadRequest(ex.getMessage())), channelHandlerContext, HttpResponseStatus.BAD_REQUEST);
}
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/execute/executor/dumper/AbstractJDBCDumper.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/execute/executor/dumper/AbstractJDBCDumper.java
index 8cc8b55..8f67fdf 100755
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/execute/executor/dumper/AbstractJDBCDumper.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/execute/executor/dumper/AbstractJDBCDumper.java
@@ -96,10 +96,10 @@ public abstract class AbstractJDBCDumper extends AbstractShardingScalingExecutor
pushRecord(record);
}
pushRecord(new FinishedRecord(new PrimaryKeyPosition.FinishedPosition()));
- } catch (SQLException e) {
+ } catch (SQLException ex) {
stop();
channel.close();
- throw new SyncTaskExecuteException(e);
+ throw new SyncTaskExecuteException(ex);
} finally {
pushRecord(new FinishedRecord(new NopPosition()));
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/position/resume/ZookeeperResumablePositionManager.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/position/resume/ZookeeperResumablePositionManager.java
index 7792072..a7c4fb9 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/position/resume/ZookeeperResumablePositionManager.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/position/resume/ZookeeperResumablePositionManager.java
@@ -49,7 +49,7 @@ public final class ZookeeperResumablePositionManager extends AbstractResumablePo
public ZookeeperResumablePositionManager() {
ResumeConfiguration resumeConfiguration = ScalingContext.getInstance().getServerConfiguration().getResumeConfiguration();
if (null != resumeConfiguration) {
- ZOOKEEPER.init(resumeConfiguration.getNamespace(), getCenterConfiguration(resumeConfiguration));
+ ZOOKEEPER.init(resumeConfiguration.getNamespace(), new OrchestrationCenterConfiguration("ZooKeeper", resumeConfiguration.getServerLists(), new Properties()));
log.info("zookeeper resumable position manager is available.");
setAvailable(true);
}
@@ -66,10 +66,6 @@ public final class ZookeeperResumablePositionManager extends AbstractResumablePo
executor.scheduleWithFixedDelay(this::persistPosition, 1, 1, TimeUnit.MINUTES);
}
- private OrchestrationCenterConfiguration getCenterConfiguration(final ResumeConfiguration resumeConfiguration) {
- return new OrchestrationCenterConfiguration("ZooKeeper", resumeConfiguration.getServerLists(), new Properties());
- }
-
@Override
public void close() {
executor.submit(this::persistPosition);
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/checker/AbstractDataSourceChecker.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/checker/AbstractDataSourceChecker.java
index e2a2dda..d8e8cd2 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/checker/AbstractDataSourceChecker.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/checker/AbstractDataSourceChecker.java
@@ -34,8 +34,8 @@ public abstract class AbstractDataSourceChecker implements DataSourceChecker {
for (DataSource each : dataSources) {
each.getConnection().close();
}
- } catch (SQLException e) {
- throw new PrepareFailedException("Datasources can't connected!");
+ } catch (SQLException ex) {
+ throw new PrepareFailedException("Datasources can't connected!", ex);
}
}
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/splitter/InventoryDataTaskSplitter.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/splitter/InventoryDataTaskSplitter.java
index 0012b01..ea90250 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/splitter/InventoryDataTaskSplitter.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/splitter/InventoryDataTaskSplitter.java
@@ -141,8 +141,8 @@ public final class InventoryDataTaskSplitter {
result.add(new SyncConfiguration(concurrency, syncConfiguration.getTableNameMap(),
splitDumperConfig, RdbmsConfiguration.clone(syncConfiguration.getImporterConfiguration())));
}
- } catch (SQLException e) {
- throw new PrepareFailedException(String.format("Split task for table %s by primary key %s error", dumperConfiguration.getTableName(), primaryKey), e);
+ } catch (SQLException ex) {
+ throw new PrepareFailedException(String.format("Split task for table %s by primary key %s error", dumperConfiguration.getTableName(), primaryKey), ex);
}
return result;
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/task/incremental/IncrementalDataScalingTask.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/task/incremental/IncrementalDataScalingTask.java
index c690e39..2d23120 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/task/incremental/IncrementalDataScalingTask.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/task/incremental/IncrementalDataScalingTask.java
@@ -107,8 +107,8 @@ public final class IncrementalDataScalingTask extends AbstractShardingScalingExe
try {
future.get();
} catch (InterruptedException ignored) {
- } catch (ExecutionException e) {
- throw new SyncTaskExecuteException(String.format("Task %s execute failed ", getTaskId()), e.getCause());
+ } catch (ExecutionException ex) {
+ throw new SyncTaskExecuteException(String.format("Task %s execute failed ", getTaskId()), ex.getCause());
}
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/task/inventory/InventoryDataScalingTask.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/task/inventory/InventoryDataScalingTask.java
index ff2880b..1ee12f0 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/task/inventory/InventoryDataScalingTask.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/task/inventory/InventoryDataScalingTask.java
@@ -110,8 +110,8 @@ public final class InventoryDataScalingTask extends AbstractShardingScalingExecu
.executeQuery();
resultSet.next();
estimatedRows = resultSet.getInt(1);
- } catch (SQLException e) {
- throw new SyncTaskExecuteException("get estimated rows error.", e);
+ } catch (SQLException ex) {
+ throw new SyncTaskExecuteException("get estimated rows error.", ex);
}
}
@@ -142,8 +142,8 @@ public final class InventoryDataScalingTask extends AbstractShardingScalingExecu
try {
future.get();
} catch (InterruptedException ignored) {
- } catch (ExecutionException e) {
- throw new SyncTaskExecuteException(String.format("Task %s execute failed ", getTaskId()), e.getCause());
+ } catch (ExecutionException ex) {
+ throw new SyncTaskExecuteException(String.format("Task %s execute failed ", getTaskId()), ex.getCause());
}
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/metadata/MetaDataManager.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/metadata/MetaDataManager.java
index 3cdd6a2..663a8b0 100755
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/metadata/MetaDataManager.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/metadata/MetaDataManager.java
@@ -48,8 +48,8 @@ public final class MetaDataManager {
if (!tableMetaDataMap.containsKey(tableName)) {
try {
TableMetaDataLoader.load(dataSource, tableName, "").ifPresent(tableMetaData -> tableMetaDataMap.put(tableName, tableMetaData));
- } catch (SQLException e) {
- throw new RuntimeException(String.format("Load metaData for table %s failed", tableName), e);
+ } catch (SQLException ex) {
+ throw new RuntimeException(String.format("Load metaData for table %s failed", tableName), ex);
}
}
return tableMetaDataMap.get(tableName);
diff --git a/shardingsphere-scaling/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/MySQLDataSourceChecker.java b/shardingsphere-scaling/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/MySQLDataSourceChecker.java
index 1428462..e8fff9f 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/MySQLDataSourceChecker.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/MySQLDataSourceChecker.java
@@ -65,8 +65,8 @@ public final class MySQLDataSourceChecker extends AbstractDataSourceChecker {
return;
}
}
- } catch (SQLException e) {
- throw new PrepareFailedException("Source datasource check privileges failed.");
+ } catch (SQLException ex) {
+ throw new PrepareFailedException("Source datasource check privileges failed.", ex);
}
throw new PrepareFailedException("Source datasource is lack of REPLICATION SLAVE, REPLICATION CLIENT ON *.* privileges.");
}
@@ -87,8 +87,8 @@ public final class MySQLDataSourceChecker extends AbstractDataSourceChecker {
for (Map.Entry<String, String> entry : REQUIRED_VARIABLES.entrySet()) {
checkVariable(connection, entry);
}
- } catch (SQLException e) {
- throw new PrepareFailedException("Source datasource check variables failed.");
+ } catch (SQLException ex) {
+ throw new PrepareFailedException("Source datasource check variables failed.", ex);
}
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/client/MySQLClient.java b/shardingsphere-scaling/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/client/MySQLClient.java
index 6d136b4..4382ecb 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/client/MySQLClient.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/client/MySQLClient.java
@@ -207,8 +207,8 @@ public final class MySQLClient {
throw new RuntimeException(((MySQLErrPacket) response).getErrorMessage());
}
throw new RuntimeException("unexpected response type");
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
+ } catch (InterruptedException | ExecutionException ex) {
+ throw new RuntimeException(ex);
}
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/PostgreSQLDataSourceChecker.java b/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/PostgreSQLDataSourceChecker.java
index 377e6a8..cd02fc6 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/PostgreSQLDataSourceChecker.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/PostgreSQLDataSourceChecker.java
@@ -46,8 +46,8 @@ public final class PostgreSQLDataSourceChecker extends AbstractDataSourceChecker
connection.prepareStatement(String.format("SELECT * FROM %s LIMIT 1", tableName)).executeQuery();
}
}
- } catch (SQLException e) {
- throw new PrepareFailedException("Datasources check failed!");
+ } catch (SQLException ex) {
+ throw new PrepareFailedException("Datasources check failed!", ex);
}
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/PostgreSQLPositionManager.java b/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/PostgreSQLPositionManager.java
index 4252743..209c511 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/PostgreSQLPositionManager.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/PostgreSQLPositionManager.java
@@ -64,8 +64,8 @@ public final class PostgreSQLPositionManager implements PositionManager<WalPosit
// Need to create slot first, hold oldest wal event.
createIfNotExists(connection);
currentPosition = getCurrentLsn(connection);
- } catch (SQLException e) {
- throw new RuntimeException("markPosition error", e);
+ } catch (SQLException ex) {
+ throw new RuntimeException("markPosition error", ex);
}
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/wal/decode/TestDecodingPlugin.java b/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/wal/decode/TestDecodingPlugin.java
index 07483d0..ce9b47d 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/wal/decode/TestDecodingPlugin.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/wal/decode/TestDecodingPlugin.java
@@ -179,16 +179,16 @@ public final class TestDecodingPlugin implements DecodingPlugin {
case "time without time zone":
try {
return timestampUtils.toTime(null, readNextString(data));
- } catch (SQLException e) {
- throw new DecodingException(e);
+ } catch (SQLException ex) {
+ throw new DecodingException(ex);
}
case "date":
return Date.valueOf(readNextString(data));
case "timestamp without time zone":
try {
return timestampUtils.toTimestamp(null, readNextString(data));
- } catch (SQLException e) {
- throw new DecodingException(e);
+ } catch (SQLException ex) {
+ throw new DecodingException(ex);
}
case "bytea":
return decodeHex(readNextString(data).substring(2));
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/metadata/MetaDataConnection.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/metadata/MetaDataConnection.java
index 98083b6..10aacfe 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/metadata/MetaDataConnection.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/metadata/MetaDataConnection.java
@@ -50,7 +50,7 @@ public final class MetaDataConnection implements Connection {
public String getCatalog() {
try {
return connection.getCatalog();
- } catch (SQLException e) {
+ } catch (SQLException ex) {
return null;
}
}
@@ -64,7 +64,7 @@ public final class MetaDataConnection implements Connection {
public String getSchema() {
try {
return connection.getSchema();
- } catch (SQLException e) {
+ } catch (SQLException ex) {
return null;
}
}
diff --git a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/manager/DataSourceXAResourceRecoveryHelper.java b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/manager/DataSourceXAResourceRecoveryHelper.java
index 5865e96..70c6dbf 100644
--- a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/manager/DataSourceXAResourceRecoveryHelper.java
+++ b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/manager/DataSourceXAResourceRecoveryHelper.java
@@ -114,8 +114,8 @@ public final class DataSourceXAResourceRecoveryHelper implements XAResourceRecov
private void disconnect() {
try {
this.xaConnection.close();
- } catch (SQLException e) {
- log.warn("Failed to close connection", e);
+ } catch (SQLException ex) {
+ log.warn("Failed to close connection", ex);
} finally {
this.xaConnection = null;
this.delegate = null;