You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2023/03/20 22:04:14 UTC
[shardingsphere] branch master updated: Remove ThreadUtil (#24700)
This is an automated email from the ASF dual-hosted git repository.
zhaojinchao 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 997dd7132a8 Remove ThreadUtil (#24700)
997dd7132a8 is described below
commit 997dd7132a8b88091be822ba27db22a8a7719303
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Tue Mar 21 06:04:06 2023 +0800
Remove ThreadUtil (#24700)
* Update checkstyle
* Remove ThreadUtil
---
..._Based_on_ShardingSphere_Demo_&_User_Case.en.md | 2 +-
.../infra/util/retry/RetryExecutor.java | 3 +-
.../connector/SocketSinkImporterConnector.java | 4 +-
.../pipeline/core/importer/DataSourceImporter.java | 5 +-
.../memory/SimpleMemoryPipelineChannel.java | 5 +-
.../data/pipeline/core/util/ThreadUtil.java | 55 ----------------------
.../opengauss/ingest/OpenGaussWALDumper.java | 5 +-
.../postgresql/ingest/PostgreSQLWALDumper.java | 5 +-
.../listener/SessionConnectionListener.java | 3 +-
.../e2e/agent/common/AgentTestActionExtension.java | 5 +-
.../e2e/env/container/atomic/ITContainers.java | 3 +-
.../pipeline/cases/PipelineContainerComposer.java | 24 ++++++----
.../test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java | 5 +-
.../cases/migration/AbstractMigrationE2EIT.java | 8 ++--
.../general/MySQLMigrationGeneralE2EIT.java | 4 +-
.../test/e2e/engine/ddl/BaseDDLE2EIT.java | 3 +-
.../test/e2e/engine/ral/BaseRALE2EIT.java | 5 +-
.../test/e2e/engine/rdl/BaseRDLE2EIT.java | 3 +-
.../cases/autocommit/MySQLAutoCommitTestCase.java | 6 +--
.../autocommit/PostgreSQLAutoCommitTestCase.java | 6 +--
.../engine/base/TransactionBaseE2EIT.java | 13 ++---
21 files changed, 60 insertions(+), 112 deletions(-)
diff --git a/docs/blog/content/material/2023_02_15_A_Distributed_Database_Load_Balancing_Architecture_Based_on_ShardingSphere_Demo_&_User_Case.en.md b/docs/blog/content/material/2023_02_15_A_Distributed_Database_Load_Balancing_Architecture_Based_on_ShardingSphere_Demo_&_User_Case.en.md
index 99e18f42a73..a05ebc51b86 100644
--- a/docs/blog/content/material/2023_02_15_A_Distributed_Database_Load_Balancing_Architecture_Based_on_ShardingSphere_Demo_&_User_Case.en.md
+++ b/docs/blog/content/material/2023_02_15_A_Distributed_Database_Load_Balancing_Architecture_Based_on_ShardingSphere_Demo_&_User_Case.en.md
@@ -1,7 +1,7 @@
+++
title = "A Distributed Database Load Balancing Architecture Based on ShardingSphere: Demo and User Case"
weight = 87
-chapter = true
+chapter = true
+++
This post introduces how to build a distributed database load-balancing architecture based on ShardingSphere, and the impact of introducing load balancing with a user case.
diff --git a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/retry/RetryExecutor.java b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/retry/RetryExecutor.java
index c5208ecc5f7..23c34927b49 100644
--- a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/retry/RetryExecutor.java
+++ b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/retry/RetryExecutor.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.infra.util.retry;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
-import java.util.concurrent.TimeUnit;
import java.util.function.BiFunction;
import java.util.function.Function;
@@ -74,7 +73,7 @@ public final class RetryExecutor {
@SneakyThrows(InterruptedException.class)
private boolean isTimeout() {
- TimeUnit.MILLISECONDS.sleep(intervalMillis);
+ Thread.sleep(intervalMillis);
if (-1L == timeoutMillis) {
return false;
}
diff --git a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/core/connector/SocketSinkImporterConnector.java b/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/core/connector/SocketSinkImporterConnector.java
index d11316c8825..7b0099e788f 100644
--- a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/core/connector/SocketSinkImporterConnector.java
+++ b/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/core/connector/SocketSinkImporterConnector.java
@@ -35,7 +35,6 @@ import org.apache.shardingsphere.data.pipeline.cdc.protocol.response.DataRecordR
import org.apache.shardingsphere.data.pipeline.cdc.util.CDCDataRecordUtil;
import org.apache.shardingsphere.data.pipeline.cdc.util.DataRecordResultConvertUtil;
import org.apache.shardingsphere.data.pipeline.core.record.RecordUtil;
-import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
import org.apache.shardingsphere.data.pipeline.spi.importer.connector.ImporterConnector;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -211,6 +210,7 @@ public final class SocketSinkImporterConnector implements ImporterConnector {
private final int batchSize;
+ @SneakyThrows(InterruptedException.class)
@Override
public void run() {
while (incrementalTaskRunning) {
@@ -224,7 +224,7 @@ public final class SocketSinkImporterConnector implements ImporterConnector {
dataRecords.add(minimumDataRecord);
}
if (dataRecords.isEmpty()) {
- ThreadUtil.sleep(200, TimeUnit.MILLISECONDS);
+ Thread.sleep(200L);
} else {
writeImmediately(dataRecords, cdcAckPositionMap);
}
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/DataSourceImporter.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/DataSourceImporter.java
index a929b2d9ddd..9468854d1a4 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/DataSourceImporter.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/DataSourceImporter.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.data.pipeline.core.importer;
import lombok.AccessLevel;
import lombok.Getter;
+import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.data.pipeline.api.config.ImporterConfiguration;
import org.apache.shardingsphere.data.pipeline.api.datasource.PipelineDataSourceManager;
@@ -37,7 +38,6 @@ import org.apache.shardingsphere.data.pipeline.api.metadata.LogicTableName;
import org.apache.shardingsphere.data.pipeline.core.exception.job.PipelineImporterJobWriteException;
import org.apache.shardingsphere.data.pipeline.core.ingest.IngestDataChangeType;
import org.apache.shardingsphere.data.pipeline.core.record.RecordUtil;
-import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
import org.apache.shardingsphere.data.pipeline.spi.importer.connector.ImporterConnector;
import org.apache.shardingsphere.data.pipeline.spi.ratelimit.JobRateLimitAlgorithm;
import org.apache.shardingsphere.data.pipeline.spi.sqlbuilder.PipelineSQLBuilder;
@@ -134,6 +134,7 @@ public final class DataSourceImporter extends AbstractLifecycleExecutor implemen
ShardingSpherePreconditions.checkState(!isRunning() || success, PipelineImporterJobWriteException::new);
}
+ @SneakyThrows(InterruptedException.class)
private boolean tryFlush(final DataSource dataSource, final List<DataRecord> buffer) {
for (int i = 0; isRunning() && i <= importerConfig.getRetryTimes(); i++) {
try {
@@ -141,7 +142,7 @@ public final class DataSourceImporter extends AbstractLifecycleExecutor implemen
return true;
} catch (final SQLException ex) {
log.error("flush failed {}/{} times.", i, importerConfig.getRetryTimes(), ex);
- ThreadUtil.sleep(Math.min(5 * 60 * 1000L, 1000L << i));
+ Thread.sleep(Math.min(5 * 60 * 1000L, 1000L << i));
}
}
return false;
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/SimpleMemoryPipelineChannel.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/SimpleMemoryPipelineChannel.java
index 723e976f75d..6484aeb0b1f 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/SimpleMemoryPipelineChannel.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/SimpleMemoryPipelineChannel.java
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.data.pipeline.core.ingest.channel.memory;
+import lombok.SneakyThrows;
import org.apache.shardingsphere.data.pipeline.api.ingest.channel.AckCallback;
import org.apache.shardingsphere.data.pipeline.api.ingest.channel.PipelineChannel;
import org.apache.shardingsphere.data.pipeline.api.ingest.record.Record;
-import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
import java.util.ArrayList;
import java.util.List;
@@ -50,6 +50,7 @@ public final class SimpleMemoryPipelineChannel implements PipelineChannel {
}
}
+ @SneakyThrows(InterruptedException.class)
// TODO thread-safe?
@Override
public List<Record> fetchRecords(final int batchSize, final int timeoutSeconds) {
@@ -59,7 +60,7 @@ public final class SimpleMemoryPipelineChannel implements PipelineChannel {
if (timeoutSeconds * 1000L <= System.currentTimeMillis() - start) {
break;
}
- ThreadUtil.sleep(100L);
+ Thread.sleep(100L);
}
queue.drainTo(result, batchSize);
return result;
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/ThreadUtil.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/ThreadUtil.java
deleted file mode 100644
index d61e588804c..00000000000
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/ThreadUtil.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.data.pipeline.core.util;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Thread util.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ThreadUtil {
-
- /**
- * Sleep ignored InterruptedException.
- *
- * @param millis sleep time
- */
- public static void sleep(final long millis) {
- try {
- Thread.sleep(millis);
- } catch (final InterruptedException ignored) {
- }
- }
-
- /**
- * Sleep ignored InterruptedException.
- *
- * @param timeout timeout
- * @param timeUnit time unit
- */
- public static void sleep(final int timeout, final TimeUnit timeUnit) {
- try {
- timeUnit.sleep(timeout);
- } catch (final InterruptedException ignored) {
- }
- }
-}
diff --git a/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ingest/OpenGaussWALDumper.java b/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ingest/OpenGaussWALDumper.java
index cd144dec30d..b3c5fc1157e 100644
--- a/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ingest/OpenGaussWALDumper.java
+++ b/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ingest/OpenGaussWALDumper.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.data.pipeline.opengauss.ingest;
+import lombok.SneakyThrows;
import org.apache.shardingsphere.data.pipeline.api.config.ingest.DumperConfiguration;
import org.apache.shardingsphere.data.pipeline.api.datasource.config.impl.StandardPipelineDataSourceConfiguration;
import org.apache.shardingsphere.data.pipeline.api.executor.AbstractLifecycleExecutor;
@@ -25,7 +26,6 @@ import org.apache.shardingsphere.data.pipeline.api.ingest.dumper.IncrementalDump
import org.apache.shardingsphere.data.pipeline.api.ingest.position.IngestPosition;
import org.apache.shardingsphere.data.pipeline.api.metadata.loader.PipelineTableMetaDataLoader;
import org.apache.shardingsphere.data.pipeline.core.ingest.exception.IngestException;
-import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
import org.apache.shardingsphere.data.pipeline.opengauss.ingest.wal.OpenGaussLogicalReplication;
import org.apache.shardingsphere.data.pipeline.opengauss.ingest.wal.decode.MppdbDecodingPlugin;
import org.apache.shardingsphere.data.pipeline.opengauss.ingest.wal.decode.OpenGaussLogSequenceNumber;
@@ -78,6 +78,7 @@ public final class OpenGaussWALDumper extends AbstractLifecycleExecutor implemen
this.decodeWithTX = dumperConfig.isDecodeWithTX();
}
+ @SneakyThrows(InterruptedException.class)
@Override
protected void runBlocking() {
PGReplicationStream stream = null;
@@ -87,7 +88,7 @@ public final class OpenGaussWALDumper extends AbstractLifecycleExecutor implemen
while (isRunning()) {
ByteBuffer message = stream.readPending();
if (null == message) {
- ThreadUtil.sleep(10L);
+ Thread.sleep(10L);
continue;
}
AbstractWALEvent event = decodingPlugin.decode(message, new OpenGaussLogSequenceNumber(stream.getLastReceiveLSN()));
diff --git a/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/PostgreSQLWALDumper.java b/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/PostgreSQLWALDumper.java
index d2ca2e23cc9..7313acac241 100644
--- a/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/PostgreSQLWALDumper.java
+++ b/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/PostgreSQLWALDumper.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.data.pipeline.postgresql.ingest;
+import lombok.SneakyThrows;
import org.apache.shardingsphere.data.pipeline.api.config.ingest.DumperConfiguration;
import org.apache.shardingsphere.data.pipeline.api.datasource.config.impl.StandardPipelineDataSourceConfiguration;
import org.apache.shardingsphere.data.pipeline.api.executor.AbstractLifecycleExecutor;
@@ -25,7 +26,6 @@ import org.apache.shardingsphere.data.pipeline.api.ingest.dumper.IncrementalDump
import org.apache.shardingsphere.data.pipeline.api.ingest.position.IngestPosition;
import org.apache.shardingsphere.data.pipeline.api.metadata.loader.PipelineTableMetaDataLoader;
import org.apache.shardingsphere.data.pipeline.core.ingest.exception.IngestException;
-import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
import org.apache.shardingsphere.data.pipeline.postgresql.ingest.wal.PostgreSQLLogicalReplication;
import org.apache.shardingsphere.data.pipeline.postgresql.ingest.wal.WALEventConverter;
import org.apache.shardingsphere.data.pipeline.postgresql.ingest.wal.WALPosition;
@@ -69,6 +69,7 @@ public final class PostgreSQLWALDumper extends AbstractLifecycleExecutor impleme
logicalReplication = new PostgreSQLLogicalReplication();
}
+ @SneakyThrows(InterruptedException.class)
@Override
protected void runBlocking() {
// TODO use unified PgConnection
@@ -81,7 +82,7 @@ public final class PostgreSQLWALDumper extends AbstractLifecycleExecutor impleme
while (isRunning()) {
ByteBuffer message = stream.readPending();
if (null == message) {
- ThreadUtil.sleep(10L);
+ Thread.sleep(10L);
continue;
}
AbstractWALEvent event = decodingPlugin.decode(message, new PostgreSQLLogSequenceNumber(stream.getLastReceiveLSN()));
diff --git a/mode/type/cluster/repository/provider/zookeeper/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/listener/SessionConnectionListener.java b/mode/type/cluster/repository/provider/zookeeper/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/listener/SessionConnectionListener.java
index 5cf6a3c9dfd..db0faaad723 100644
--- a/mode/type/cluster/repository/provider/zookeeper/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/listener/SessionConnectionListener.java
+++ b/mode/type/cluster/repository/provider/zookeeper/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/listener/SessionConnectionListener.java
@@ -32,7 +32,6 @@ import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositor
import org.apache.shardingsphere.mode.repository.cluster.zookeeper.handler.ZookeeperExceptionHandler;
import java.util.Properties;
-import java.util.concurrent.TimeUnit;
/**
* Session connection state listener.
@@ -89,6 +88,6 @@ public final class SessionConnectionListener implements ConnectionStateListener
@SneakyThrows(InterruptedException.class)
private void sleepInterval() {
- TimeUnit.SECONDS.sleep(RECONNECT_INTERVAL_SECONDS);
+ Thread.sleep(RECONNECT_INTERVAL_SECONDS * 1000L);
}
}
diff --git a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/AgentTestActionExtension.java b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/AgentTestActionExtension.java
index 28dcf4a69cf..b89f6f34ee4 100644
--- a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/AgentTestActionExtension.java
+++ b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/AgentTestActionExtension.java
@@ -28,7 +28,6 @@ import org.junit.jupiter.api.extension.ExtensionContext;
import javax.sql.DataSource;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.TimeUnit;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assumptions.assumeFalse;
@@ -74,12 +73,12 @@ public final class AgentTestActionExtension implements BeforeEachCallback {
private void sleep() {
if (!hasSleep) {
log.info("Waiting to collect data ...");
- TimeUnit.MILLISECONDS.sleep(getSleepTime());
+ Thread.sleep(getSleepMilliseconds());
hasSleep = true;
}
}
- private Long getSleepTime() {
+ private Long getSleepMilliseconds() {
return Long.valueOf(E2ETestEnvironment.getInstance().getProps().getProperty("collect.data.wait.milliseconds", "0"));
}
}
diff --git a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/ITContainers.java b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/ITContainers.java
index 5543e05b00c..84972850f1e 100644
--- a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/ITContainers.java
+++ b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/ITContainers.java
@@ -28,7 +28,6 @@ import org.testcontainers.lifecycle.Startable;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
-import java.util.concurrent.TimeUnit;
/**
* IT containers.
@@ -101,7 +100,7 @@ public final class ITContainers implements Startable {
.forEach(each -> {
while (!(each.isRunning() && each.isHealthy())) {
try {
- TimeUnit.MILLISECONDS.sleep(500L);
+ Thread.sleep(500L);
} catch (final InterruptedException ignored) {
}
}
diff --git a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
index ab7d60c7ce4..029ea4e5d65 100644
--- a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
+++ b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
@@ -22,7 +22,6 @@ import lombok.Getter;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.data.pipeline.api.job.JobStatus;
-import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
import org.apache.shardingsphere.data.pipeline.spi.job.JobType;
import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory;
import org.apache.shardingsphere.infra.database.metadata.url.JdbcUrlAppender;
@@ -167,23 +166,25 @@ public final class PipelineContainerComposer implements AutoCloseable {
}
}
+ @SneakyThrows(InterruptedException.class)
private void cleanUpProxyDatabase(final Connection connection) {
if (PipelineEnvTypeEnum.NATIVE != PipelineE2EEnvironment.getInstance().getItEnvType()) {
return;
}
try {
connection.createStatement().execute(String.format("DROP DATABASE IF EXISTS %s", PROXY_DATABASE));
- ThreadUtil.sleep(2, TimeUnit.SECONDS);
+ Thread.sleep(2000L);
} catch (final SQLException ex) {
log.warn("Drop proxy database failed, error={}", ex.getMessage());
}
}
+ @SneakyThrows(InterruptedException.class)
private void createProxyDatabase(final Connection connection) throws SQLException {
String sql = String.format("CREATE DATABASE %s", PROXY_DATABASE);
log.info("Create proxy database {}", PROXY_DATABASE);
connection.createStatement().execute(sql);
- ThreadUtil.sleep(2, TimeUnit.SECONDS);
+ Thread.sleep(2000L);
}
private void cleanUpDataSource() {
@@ -272,13 +273,14 @@ public final class PipelineContainerComposer implements AutoCloseable {
* @param sleepSeconds sleep seconds
* @throws SQLException SQL exception
*/
+ @SneakyThrows(InterruptedException.class)
public void createSchema(final Connection connection, final int sleepSeconds) throws SQLException {
if (!getDatabaseType().isSchemaAvailable()) {
return;
}
connection.createStatement().execute(String.format("CREATE SCHEMA %s", SCHEMA_NAME));
if (sleepSeconds > 0) {
- ThreadUtil.sleep(sleepSeconds, TimeUnit.SECONDS);
+ Thread.sleep(sleepSeconds * 1000L);
}
}
@@ -347,12 +349,13 @@ public final class PipelineContainerComposer implements AutoCloseable {
* @param sleepSeconds sleep seconds
* @throws SQLException SQL exception
*/
+ @SneakyThrows(InterruptedException.class)
public void proxyExecuteWithLog(final String sql, final int sleepSeconds) throws SQLException {
log.info("proxy execute :{}", sql);
try (Connection connection = proxyDataSource.getConnection()) {
connection.createStatement().execute(sql);
}
- ThreadUtil.sleep(Math.max(sleepSeconds, 0), TimeUnit.SECONDS);
+ Thread.sleep(Math.max(sleepSeconds * 1000L, 0L));
}
/**
@@ -360,12 +363,13 @@ public final class PipelineContainerComposer implements AutoCloseable {
*
* @param distSQL dist SQL
*/
+ @SneakyThrows(InterruptedException.class)
public void waitJobPrepareSuccess(final String distSQL) {
for (int i = 0; i < 5; i++) {
List<Map<String, Object>> jobStatus = queryForListWithLog(distSQL);
Set<String> statusSet = jobStatus.stream().map(each -> String.valueOf(each.get("status"))).collect(Collectors.toSet());
if (statusSet.contains(JobStatus.PREPARING.name()) || statusSet.contains(JobStatus.RUNNING.name())) {
- ThreadUtil.sleep(2, TimeUnit.SECONDS);
+ Thread.sleep(2000L);
}
}
}
@@ -376,6 +380,7 @@ public final class PipelineContainerComposer implements AutoCloseable {
* @param sql SQL
* @return query result
*/
+ @SneakyThrows(InterruptedException.class)
public List<Map<String, Object>> queryForListWithLog(final String sql) {
int retryNumber = 0;
while (retryNumber <= 3) {
@@ -385,7 +390,7 @@ public final class PipelineContainerComposer implements AutoCloseable {
} catch (final SQLException ex) {
log.error("Data access error.", ex);
}
- ThreadUtil.sleep(3, TimeUnit.SECONDS);
+ Thread.sleep(3000L);
retryNumber++;
}
throw new RuntimeException("Can not get result from proxy.");
@@ -449,7 +454,7 @@ public final class PipelineContainerComposer implements AutoCloseable {
assertFalse(actualStatus.contains(JobStatus.EXECUTE_INVENTORY_TASK_FAILURE.name()), "status is JobStatus.EXECUTE_INVENTORY_TASK_FAILURE");
assertFalse(actualStatus.contains(JobStatus.EXECUTE_INCREMENTAL_TASK_FAILURE.name()), "status is JobStatus.EXECUTE_INCREMENTAL_TASK_FAILURE");
if (Collections.min(incrementalIdleSecondsList) <= 5) {
- ThreadUtil.sleep(3, TimeUnit.SECONDS);
+ Thread.sleep(3000L);
continue;
}
if (actualStatus.size() == 1 && actualStatus.contains(JobStatus.EXECUTE_INCREMENTAL_TASK.name())) {
@@ -480,6 +485,7 @@ public final class PipelineContainerComposer implements AutoCloseable {
*
* @param sql SQL
*/
+ @SneakyThrows(InterruptedException.class)
public void assertProxyOrderRecordExist(final String sql) {
boolean recordExist = false;
for (int i = 0; i < 5; i++) {
@@ -488,7 +494,7 @@ public final class PipelineContainerComposer implements AutoCloseable {
if (recordExist) {
break;
}
- ThreadUtil.sleep(2, TimeUnit.SECONDS);
+ Thread.sleep(2000L);
}
assertTrue(recordExist, "The insert record must exist after the stop");
}
diff --git a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java
index a70dcb628f5..22e314d0433 100644
--- a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java
+++ b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.test.e2e.data.pipeline.cases.cdc;
+import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.shardingsphere.data.pipeline.api.check.consistency.DataConsistencyCheckResult;
@@ -34,7 +35,6 @@ import org.apache.shardingsphere.data.pipeline.core.check.consistency.Consistenc
import org.apache.shardingsphere.data.pipeline.core.check.consistency.SingleTableInventoryDataConsistencyChecker;
import org.apache.shardingsphere.data.pipeline.core.check.consistency.algorithm.DataMatchDataConsistencyCalculateAlgorithm;
import org.apache.shardingsphere.data.pipeline.core.metadata.loader.StandardPipelineTableMetaDataLoader;
-import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
import org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm;
@@ -156,13 +156,14 @@ public final class CDCE2EIT {
containerComposer.proxyExecuteWithLog(CREATE_SHARDING_RULE_SQL, 2);
}
+ @SneakyThrows(InterruptedException.class)
private void initSchemaAndTable(final PipelineContainerComposer containerComposer, final Connection connection, final int sleepSeconds) throws SQLException {
containerComposer.createSchema(connection, sleepSeconds);
String sql = containerComposer.getExtraSQLCommand().getCreateTableOrder(SOURCE_TABLE_NAME);
log.info("create table sql: {}", sql);
connection.createStatement().execute(sql);
if (sleepSeconds > 0) {
- ThreadUtil.sleep(sleepSeconds, TimeUnit.SECONDS);
+ Thread.sleep(sleepSeconds * 1000L);
}
}
diff --git a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/AbstractMigrationE2EIT.java b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/AbstractMigrationE2EIT.java
index cdab5a8d7b8..9f0d4910be7 100644
--- a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/AbstractMigrationE2EIT.java
+++ b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/AbstractMigrationE2EIT.java
@@ -19,8 +19,8 @@ package org.apache.shardingsphere.test.e2e.data.pipeline.cases.migration;
import com.google.common.base.Strings;
import lombok.Getter;
+import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
-import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
import org.apache.shardingsphere.test.e2e.data.pipeline.cases.PipelineContainerComposer;
import org.apache.shardingsphere.test.e2e.data.pipeline.command.MigrationDistSQLCommand;
import org.apache.shardingsphere.test.e2e.data.pipeline.env.PipelineE2EEnvironment;
@@ -34,7 +34,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static org.hamcrest.CoreMatchers.is;
@@ -142,6 +141,7 @@ public abstract class AbstractMigrationE2EIT {
return jobList.stream().filter(a -> a.get("tables").toString().equals(tableName)).findFirst().orElseThrow(() -> new RuntimeException("not find " + tableName + " table")).get("id").toString();
}
+ @SneakyThrows(InterruptedException.class)
protected void assertCheckMigrationSuccess(final PipelineContainerComposer containerComposer, final String jobId, final String algorithmType) throws SQLException {
containerComposer.proxyExecuteWithLog(String.format("CHECK MIGRATION '%s' BY TYPE (NAME='%s')", jobId, algorithmType), 0);
// TODO Need to add after the stop then to start, can continue the consistency check from the previous progress
@@ -149,14 +149,14 @@ public abstract class AbstractMigrationE2EIT {
for (int i = 0; i < 10; i++) {
resultList = containerComposer.queryForListWithLog(String.format("SHOW MIGRATION CHECK STATUS '%s'", jobId));
if (resultList.isEmpty()) {
- ThreadUtil.sleep(3, TimeUnit.SECONDS);
+ Thread.sleep(3000L);
continue;
}
List<String> checkEndTimeList = resultList.stream().map(map -> map.get("check_end_time").toString()).filter(each -> !Strings.isNullOrEmpty(each)).collect(Collectors.toList());
if (checkEndTimeList.size() == resultList.size()) {
break;
} else {
- ThreadUtil.sleep(3, TimeUnit.SECONDS);
+ Thread.sleep(3000L);
}
}
log.info("check job results: {}", resultList);
diff --git a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
index dc2abb4354d..c26a1793ffe 100644
--- a/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
+++ b/test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.test.e2e.data.pipeline.cases.migration.general
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.tuple.Pair;
-import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
import org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm;
@@ -41,7 +40,6 @@ import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.TimeUnit;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -82,7 +80,7 @@ public final class MySQLMigrationGeneralE2EIT extends AbstractMigrationE2EIT {
assertMigrationSuccessById(containerComposer, orderJobId, "DATA_MATCH");
String orderItemJobId = getJobIdByTableName(containerComposer, "ds_0.t_order_item");
assertMigrationSuccessById(containerComposer, orderItemJobId, "DATA_MATCH");
- ThreadUtil.sleep(2, TimeUnit.SECONDS);
+ Thread.sleep(2000L);
assertMigrationSuccessById(containerComposer, orderItemJobId, "CRC32_MATCH");
for (String each : listJobId(containerComposer)) {
commitMigrationByJobId(containerComposer, each);
diff --git a/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/ddl/BaseDDLE2EIT.java b/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/ddl/BaseDDLE2EIT.java
index f20a22827f0..4857c8992ec 100644
--- a/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/ddl/BaseDDLE2EIT.java
+++ b/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/ddl/BaseDDLE2EIT.java
@@ -37,7 +37,6 @@ import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static org.hamcrest.CoreMatchers.is;
@@ -213,6 +212,6 @@ public abstract class BaseDDLE2EIT {
@SneakyThrows(InterruptedException.class)
protected void waitCompleted() {
- TimeUnit.MILLISECONDS.sleep(1500);
+ Thread.sleep(1500L);
}
}
diff --git a/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/ral/BaseRALE2EIT.java b/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/ral/BaseRALE2EIT.java
index 03eaf124fcd..606fb1dae33 100644
--- a/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/ral/BaseRALE2EIT.java
+++ b/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/ral/BaseRALE2EIT.java
@@ -31,7 +31,6 @@ import java.sql.SQLException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
-import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static org.hamcrest.CoreMatchers.is;
@@ -92,9 +91,9 @@ public abstract class BaseRALE2EIT {
sleep(1000L);
}
- protected void sleep(final long timeout) {
+ protected void sleep(final long timeoutMillis) {
try {
- TimeUnit.MILLISECONDS.sleep(timeout);
+ Thread.sleep(timeoutMillis);
} catch (final InterruptedException ignored) {
}
}
diff --git a/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/rdl/BaseRDLE2EIT.java b/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/rdl/BaseRDLE2EIT.java
index 87d2dba21f0..6864bfc73b7 100644
--- a/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/rdl/BaseRDLE2EIT.java
+++ b/test/e2e/suite/src/test/java/org/apache/shardingsphere/test/e2e/engine/rdl/BaseRDLE2EIT.java
@@ -31,7 +31,6 @@ import java.sql.SQLException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
-import java.util.concurrent.TimeUnit;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -92,7 +91,7 @@ public abstract class BaseRDLE2EIT {
protected void sleep() {
try {
- TimeUnit.SECONDS.sleep(2L);
+ Thread.sleep(2000L);
} catch (final InterruptedException ignored) {
}
}
diff --git a/test/e2e/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/MySQLAutoCommitTestCase.java b/test/e2e/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/MySQLAutoCommitTestCase.java
index c2964a5cb58..44aeed811ab 100644
--- a/test/e2e/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/MySQLAutoCommitTestCase.java
+++ b/test/e2e/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/MySQLAutoCommitTestCase.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.test.e2e.transaction.cases.autocommit;
-import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
+import lombok.SneakyThrows;
import org.apache.shardingsphere.test.e2e.transaction.cases.base.BaseTransactionTestCase;
import org.apache.shardingsphere.test.e2e.transaction.engine.base.TransactionBaseE2EIT;
import org.apache.shardingsphere.test.e2e.transaction.engine.base.TransactionContainerComposer;
@@ -28,7 +28,6 @@ import org.apache.shardingsphere.transaction.api.TransactionType;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
-import java.util.concurrent.TimeUnit;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -48,6 +47,7 @@ public final class MySQLAutoCommitTestCase extends BaseTransactionTestCase {
assertAutoCommit();
}
+ @SneakyThrows(InterruptedException.class)
private void assertAutoCommit() throws SQLException {
// TODO Currently XA transaction does not support two transactions in the same thread at the same time
try (Connection connection1 = getDataSource().getConnection(); Connection connection2 = getDataSource().getConnection()) {
@@ -58,7 +58,7 @@ public final class MySQLAutoCommitTestCase extends BaseTransactionTestCase {
executeWithLog(connection1, "insert into account(id, balance, transaction_id) values(1, 100, 1);");
assertFalse(executeQueryWithLog(connection2, "select * from account;").next());
connection1.commit();
- ThreadUtil.sleep(1, TimeUnit.SECONDS);
+ Thread.sleep(1000L);
assertTrue(executeQueryWithLog(connection2, "select * from account;").next());
}
}
diff --git a/test/e2e/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/PostgreSQLAutoCommitTestCase.java b/test/e2e/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/PostgreSQLAutoCommitTestCase.java
index c94a8171ed4..8ff61f54578 100644
--- a/test/e2e/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/PostgreSQLAutoCommitTestCase.java
+++ b/test/e2e/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/PostgreSQLAutoCommitTestCase.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.test.e2e.transaction.cases.autocommit;
-import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
+import lombok.SneakyThrows;
import org.apache.shardingsphere.test.e2e.transaction.cases.base.BaseTransactionTestCase;
import org.apache.shardingsphere.test.e2e.transaction.engine.base.TransactionBaseE2EIT;
import org.apache.shardingsphere.test.e2e.transaction.engine.base.TransactionContainerComposer;
@@ -28,7 +28,6 @@ import org.apache.shardingsphere.transaction.api.TransactionType;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
-import java.util.concurrent.TimeUnit;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -48,6 +47,7 @@ public final class PostgreSQLAutoCommitTestCase extends BaseTransactionTestCase
assertAutoCommit();
}
+ @SneakyThrows(InterruptedException.class)
private void assertAutoCommit() throws SQLException {
try (Connection connection1 = getDataSource().getConnection(); Connection connection2 = getDataSource().getConnection()) {
executeWithLog(connection1, "set transaction isolation level read committed;");
@@ -57,7 +57,7 @@ public final class PostgreSQLAutoCommitTestCase extends BaseTransactionTestCase
executeWithLog(connection1, "insert into account(id, balance, transaction_id) values(1, 100, 1);");
assertFalse(executeQueryWithLog(connection2, "select * from account;").next());
connection1.commit();
- ThreadUtil.sleep(1, TimeUnit.SECONDS);
+ Thread.sleep(1000L);
assertTrue(executeQueryWithLog(connection2, "select * from account;").next());
}
}
diff --git a/test/e2e/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/base/TransactionBaseE2EIT.java b/test/e2e/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/base/TransactionBaseE2EIT.java
index a9af3613d60..4b7cb3bb6e4 100644
--- a/test/e2e/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/base/TransactionBaseE2EIT.java
+++ b/test/e2e/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/engine/base/TransactionBaseE2EIT.java
@@ -21,7 +21,6 @@ import com.google.common.base.Preconditions;
import lombok.Getter;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
-import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
@@ -63,7 +62,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -224,15 +222,16 @@ public abstract class TransactionBaseE2EIT {
&& Objects.equals(transactionRuleMap.get(TransactionTestConstants.PROVIDER_TYPE), expectedProviderType);
}
+ @SneakyThrows(InterruptedException.class)
private boolean waitExpectedTransactionRule(final TransactionType expectedTransType, final String expectedProviderType, final TransactionContainerComposer containerComposer) throws SQLException {
- ThreadUtil.sleep(5, TimeUnit.SECONDS);
+ Thread.sleep(5000L);
try (Connection connection = containerComposer.getDataSource().getConnection()) {
int waitTimes = 0;
do {
if (isExpectedTransactionRule(connection, expectedTransType, expectedProviderType)) {
return true;
}
- ThreadUtil.sleep(2, TimeUnit.SECONDS);
+ Thread.sleep(2000L);
waitTimes++;
} while (waitTimes <= 3);
return false;
@@ -295,12 +294,14 @@ public abstract class TransactionBaseE2EIT {
assertThat(countWithLog("SHOW SHARDING TABLE RULES FROM sharding_db;", containerComposer), is(3));
}
+ @SneakyThrows(InterruptedException.class)
private void executeWithLog(final Connection connection, final String sql) throws SQLException {
log.info("Connection execute:{}.", sql);
connection.createStatement().execute(sql);
- ThreadUtil.sleep(1, TimeUnit.SECONDS);
+ Thread.sleep(1000L);
}
+ @SneakyThrows(InterruptedException.class)
private int countWithLog(final String sql, final TransactionContainerComposer containerComposer) throws SQLException {
try (Connection connection = containerComposer.getDataSource().getConnection()) {
int retryNumber = 0;
@@ -316,7 +317,7 @@ public abstract class TransactionBaseE2EIT {
} catch (final SQLException ex) {
log.error("Data access error.", ex);
}
- ThreadUtil.sleep(2, TimeUnit.SECONDS);
+ Thread.sleep(2000L);
retryNumber++;
}
}