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 d51f62a Cleanup useless codes (#16028)
d51f62a is described below
commit d51f62afdfd9f8173021df1b073f94d151c37002
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Mar 13 13:10:04 2022 +0800
Cleanup useless codes (#16028)
---
.../DataMatchSingleTableDataCalculator.java | 3 --
.../schedule/core/api/ModeScheduleContext.java | 56 +---------------------
.../communication/DatabaseCommunicationEngine.java | 1 -
.../DatabaseCommunicationEngineFactory.java | 4 +-
.../communication/vertx/VertxBackendStatement.java | 8 +---
5 files changed, 6 insertions(+), 66 deletions(-)
diff --git
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/spi/check/consistency/DataMatchSingleTableDataCalculator.java
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/spi/check/consistency/DataMatchSingleTableDataCalculator.java
index e34bad5..14540e4 100644
---
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/spi/check/consistency/DataMatchSingleTableDataCalculator.java
+++
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/spi/check/consistency/DataMatchSingleTableDataCalculator.java
@@ -137,14 +137,11 @@ public final class DataMatchSingleTableDataCalculator
extends AbstractStreamingS
if (!(o instanceof CalculatedResult)) {
return false;
}
-
final CalculatedResult that = (CalculatedResult) o;
-
boolean equalsFirst = new EqualsBuilder().append(getRecordCount(),
that.getRecordCount()).append(getMaxUniqueKeyValue(),
that.getMaxUniqueKeyValue()).isEquals();
if (!equalsFirst) {
return false;
}
-
Iterator<Collection<Object>> thisIterator =
this.records.iterator();
Iterator<Collection<Object>> thatIterator =
that.records.iterator();
while (thisIterator.hasNext() && thatIterator.hasNext()) {
diff --git
a/shardingsphere-kernel/shardingsphere-schedule/shardingsphere-schedule-core/src/main/java/org/apache/shardingsphere/schedule/core/api/ModeScheduleContext.java
b/shardingsphere-kernel/shardingsphere-schedule/shardingsphere-schedule-core/src/main/java/org/apache/shardingsphere/schedule/core/api/ModeScheduleContext.java
index ee6009a..3837caa 100644
---
a/shardingsphere-kernel/shardingsphere-schedule/shardingsphere-schedule-core/src/main/java/org/apache/shardingsphere/schedule/core/api/ModeScheduleContext.java
+++
b/shardingsphere-kernel/shardingsphere-schedule/shardingsphere-schedule-core/src/main/java/org/apache/shardingsphere/schedule/core/api/ModeScheduleContext.java
@@ -23,10 +23,7 @@ import
org.apache.commons.lang3.concurrent.ConcurrentException;
import org.apache.commons.lang3.concurrent.LazyInitializer;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
-import org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO;
import
org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap;
-import
org.apache.shardingsphere.elasticjob.lite.lifecycle.api.JobConfigurationAPI;
-import
org.apache.shardingsphere.elasticjob.lite.lifecycle.internal.settings.JobConfigurationAPIImpl;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
import
org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration;
import
org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter;
@@ -50,20 +47,13 @@ public final class ModeScheduleContext {
private final ModeConfiguration modeConfig;
private final LazyInitializer<CoordinatorRegistryCenter>
registryCenterLazyInitializer = new
LazyInitializer<CoordinatorRegistryCenter>() {
+
@Override
protected CoordinatorRegistryCenter initialize() {
return initRegistryCenter(modeConfig);
}
};
- private final LazyInitializer<JobConfigurationAPI>
jobConfigAPILazyInitializer = new LazyInitializer<JobConfigurationAPI>() {
- @Override
- protected JobConfigurationAPI initialize() throws ConcurrentException {
- CoordinatorRegistryCenter registryCenter =
registryCenterLazyInitializer.get();
- return null != registryCenter ? new
JobConfigurationAPIImpl(registryCenter) : null;
- }
- };
-
public ModeScheduleContext(final ModeConfiguration modeConfig) {
this.modeConfig = modeConfig;
}
@@ -103,24 +93,6 @@ public final class ModeScheduleContext {
return null;
}
- /**
- * Schedule with cron.
- *
- * @param jobName job name
- * @param job job implementation
- * @param cron cron expression
- */
- public void scheduleWithCron(final String jobName, final
Consumer<JobParameter> job, final String cron) {
- CoordinatorRegistryCenter registryCenter = getRegistryCenter();
- if (null == registryCenter) {
- log.warn("registryCenter is null, ignore, jobName={}, cron={}",
job, cron);
- return;
- }
- JobConfiguration jobConfig = JobConfiguration.newBuilder(jobName,
1).cron(cron).build();
- ScheduleJobBootstrap bootstrap = new
ScheduleJobBootstrap(registryCenter, new ConsumerSimpleJob(job), jobConfig);
- bootstrap.schedule();
- }
-
@SneakyThrows(ConcurrentException.class)
private CoordinatorRegistryCenter getRegistryCenter() {
return registryCenterLazyInitializer.get();
@@ -131,7 +103,7 @@ public final class ModeScheduleContext {
*
* @param job cron job
*/
- @SuppressWarnings("all")
+ @SuppressWarnings("unchecked")
public void startCronJob(final CronJob job) {
CoordinatorRegistryCenter registryCenter = getRegistryCenter();
if (null == registryCenter) {
@@ -147,30 +119,6 @@ public final class ModeScheduleContext {
SCHEDULE_JOB_BOOTSTRAP_MAP.get(job.getJobName()).schedule();
}
- /**
- * Update job cron.
- *
- * @param jobName job name
- * @param cron cron expression
- */
- public void updateJobCron(final String jobName, final String cron) {
- JobConfigurationAPI jobConfigAPI = getJobConfigAPI();
- if (null == jobConfigAPI) {
- log.warn("jobConfigAPI is null, ignore, jobName={}, cron={}",
jobName, cron);
- return;
- }
- JobConfigurationPOJO jobConfig = new JobConfigurationPOJO();
- jobConfig.setJobName(jobName);
- jobConfig.setCron(cron);
- jobConfig.setShardingTotalCount(1);
- jobConfigAPI.updateJobConfiguration(jobConfig);
- }
-
- @SneakyThrows(ConcurrentException.class)
- private JobConfigurationAPI getJobConfigAPI() {
- return jobConfigAPILazyInitializer.get();
- }
-
private static final class ConsumerSimpleJob implements SimpleJob {
private final Consumer<JobParameter> job;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
index ac0a643..3798277 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
@@ -218,5 +218,4 @@ public abstract class DatabaseCommunicationEngine<T> {
protected boolean isBinary() {
return !JDBCDriverType.STATEMENT.equals(driverType);
}
-
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactory.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactory.java
index f94a436..975af19 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactory.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactory.java
@@ -84,8 +84,8 @@ public final class DatabaseCommunicationEngineFactory {
* @param backendConnection backend connection
* @return binary protocol backend handler
*/
- public <T extends DatabaseCommunicationEngine> T
newBinaryProtocolInstance(final SQLStatementContext<?> sqlStatementContext,
final String sql,
- final
List<Object> parameters, final BackendConnection<?> backendConnection) {
+ public <T extends DatabaseCommunicationEngine> T
newBinaryProtocolInstance(final SQLStatementContext<?> sqlStatementContext,
final String sql,
+
final List<Object> parameters, final BackendConnection<?> backendConnection) {
ShardingSphereMetaData metaData =
ProxyContext.getInstance().getMetaData(backendConnection.getConnectionSession().getSchemaName());
LogicSQL logicSQL = new LogicSQL(sqlStatementContext, sql, parameters);
T result;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/vertx/VertxBackendStatement.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/vertx/VertxBackendStatement.java
index 52f1b15..877f4d9 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/vertx/VertxBackendStatement.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/vertx/VertxBackendStatement.java
@@ -22,28 +22,24 @@ import io.vertx.sqlclient.Query;
import io.vertx.sqlclient.Row;
import io.vertx.sqlclient.RowSet;
import io.vertx.sqlclient.SqlClient;
-import lombok.Getter;
import org.apache.shardingsphere.infra.executor.sql.context.ExecutionUnit;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode;
import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.vertx.ExecutorVertxStatementManager;
import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.vertx.VertxExecutionContext;
-import java.sql.SQLException;
-
/**
* Vert.x backend statement.
*/
-@Getter
public final class VertxBackendStatement implements
ExecutorVertxStatementManager {
@Override
- public Future<Query<RowSet<Row>>> createStorageResource(final Future<?
extends SqlClient> connection, final ConnectionMode connectionMode, final
VertxExecutionContext option) throws SQLException {
+ public Future<Query<RowSet<Row>>> createStorageResource(final Future<?
extends SqlClient> connection, final ConnectionMode connectionMode, final
VertxExecutionContext option) {
return Future.failedFuture(new UnsupportedOperationException("Vert.x
query is not like JDBC statement."));
}
@Override
public Future<Query<RowSet<Row>>> createStorageResource(final
ExecutionUnit executionUnit, final Future<? extends SqlClient> connection,
- final
ConnectionMode connectionMode, final VertxExecutionContext option) throws
SQLException {
+ final
ConnectionMode connectionMode, final VertxExecutionContext option) {
return Future.failedFuture(new UnsupportedOperationException("Vert.x
prepared query is not like JDBC prepared statement."));
}
}