This is an automated email from the ASF dual-hosted git repository.
panjuan 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 05215d9 Call ScalingAPIFactory.getScalingAPI() on demand to prevent
RALUpdater init exception when scaling not enabled (#12545)
05215d9 is described below
commit 05215d9741dcd3b8066f6fbdce27ec25fa0071e9
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Sun Sep 19 21:14:46 2021 +0800
Call ScalingAPIFactory.getScalingAPI() on demand to prevent RALUpdater init
exception when scaling not enabled (#12545)
---
.../scaling/distsql/handler/DropScalingJobUpdater.java | 5 +----
.../scaling/distsql/handler/ResetScalingJobUpdater.java | 5 +----
.../scaling/distsql/handler/StartScalingJobUpdater.java | 5 +----
.../scaling/distsql/handler/StopScalingJobUpdater.java | 5 +----
4 files changed, 4 insertions(+), 16 deletions(-)
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/DropScalingJobUpdater.java
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/DropScalingJobUpdater.java
index 7136378..d5da43f 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/DropScalingJobUpdater.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/DropScalingJobUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.scaling.distsql.handler;
import org.apache.shardingsphere.infra.distsql.update.RALUpdater;
-import org.apache.shardingsphere.scaling.core.api.ScalingAPI;
import org.apache.shardingsphere.scaling.core.api.ScalingAPIFactory;
import
org.apache.shardingsphere.scaling.distsql.statement.DropScalingJobStatement;
@@ -27,11 +26,9 @@ import
org.apache.shardingsphere.scaling.distsql.statement.DropScalingJobStateme
*/
public final class DropScalingJobUpdater implements
RALUpdater<DropScalingJobStatement> {
- private final ScalingAPI scalingAPI = ScalingAPIFactory.getScalingAPI();
-
@Override
public void executeUpdate(final DropScalingJobStatement sqlStatement) {
- scalingAPI.remove(sqlStatement.getJobId());
+ ScalingAPIFactory.getScalingAPI().remove(sqlStatement.getJobId());
}
@Override
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/ResetScalingJobUpdater.java
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/ResetScalingJobUpdater.java
index 7c16d96..a9c125c 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/ResetScalingJobUpdater.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/ResetScalingJobUpdater.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.scaling.distsql.handler;
import
org.apache.shardingsphere.scaling.distsql.exception.ScalingJobOperateException;
import org.apache.shardingsphere.infra.distsql.update.RALUpdater;
-import org.apache.shardingsphere.scaling.core.api.ScalingAPI;
import org.apache.shardingsphere.scaling.core.api.ScalingAPIFactory;
import
org.apache.shardingsphere.scaling.distsql.statement.ResetScalingJobStatement;
@@ -30,12 +29,10 @@ import java.sql.SQLException;
*/
public final class ResetScalingJobUpdater implements
RALUpdater<ResetScalingJobStatement> {
- private final ScalingAPI scalingAPI = ScalingAPIFactory.getScalingAPI();
-
@Override
public void executeUpdate(final ResetScalingJobStatement sqlStatement) {
try {
- scalingAPI.reset(sqlStatement.getJobId());
+ ScalingAPIFactory.getScalingAPI().reset(sqlStatement.getJobId());
} catch (final SQLException ex) {
throw new ScalingJobOperateException(ex.getMessage());
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/StartScalingJobUpdater.java
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/StartScalingJobUpdater.java
index e2676c3..1ccdfa8 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/StartScalingJobUpdater.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/StartScalingJobUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.scaling.distsql.handler;
import org.apache.shardingsphere.infra.distsql.update.RALUpdater;
-import org.apache.shardingsphere.scaling.core.api.ScalingAPI;
import org.apache.shardingsphere.scaling.core.api.ScalingAPIFactory;
import
org.apache.shardingsphere.scaling.distsql.statement.StartScalingJobStatement;
@@ -27,11 +26,9 @@ import
org.apache.shardingsphere.scaling.distsql.statement.StartScalingJobStatem
*/
public final class StartScalingJobUpdater implements
RALUpdater<StartScalingJobStatement> {
- private final ScalingAPI scalingAPI = ScalingAPIFactory.getScalingAPI();
-
@Override
public void executeUpdate(final StartScalingJobStatement sqlStatement) {
- scalingAPI.start(sqlStatement.getJobId());
+ ScalingAPIFactory.getScalingAPI().start(sqlStatement.getJobId());
}
@Override
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/StopScalingJobUpdater.java
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/StopScalingJobUpdater.java
index f0f8627..ae439e7 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/StopScalingJobUpdater.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-distsql/shardingsphere-scaling-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/StopScalingJobUpdater.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.scaling.distsql.handler;
import org.apache.shardingsphere.infra.distsql.update.RALUpdater;
-import org.apache.shardingsphere.scaling.core.api.ScalingAPI;
import org.apache.shardingsphere.scaling.core.api.ScalingAPIFactory;
import
org.apache.shardingsphere.scaling.distsql.statement.StopScalingJobStatement;
@@ -27,11 +26,9 @@ import
org.apache.shardingsphere.scaling.distsql.statement.StopScalingJobStateme
*/
public final class StopScalingJobUpdater implements
RALUpdater<StopScalingJobStatement> {
- private final ScalingAPI scalingAPI = ScalingAPIFactory.getScalingAPI();
-
@Override
public void executeUpdate(final StopScalingJobStatement sqlStatement) {
- scalingAPI.stop(sqlStatement.getJobId());
+ ScalingAPIFactory.getScalingAPI().stop(sqlStatement.getJobId());
}
@Override