2424import io .cdap .cdap .api .plugin .PluginConfig ;
2525import io .cdap .plugin .common .KeyValueListParser ;
2626import io .cdap .plugin .db .config .DatabaseConnectionConfig ;
27+ import io .cdap .plugin .util .RetryUtils ;
2728
2829import java .util .Collections ;
2930import java .util .HashMap ;
@@ -45,12 +46,6 @@ public abstract class ConnectionConfig extends PluginConfig implements DatabaseC
4546 public static final String CONNECTION_ARGUMENTS = "connectionArguments" ;
4647 public static final String JDBC_PLUGIN_NAME = "jdbcPluginName" ;
4748 public static final String JDBC_PLUGIN_TYPE = "jdbc" ;
48- private static final String NAME_INITIAL_RETRY_DURATION = "initialRetryDuration" ;
49- private static final String NAME_MAX_RETRY_DURATION = "maxRetryDuration" ;
50- private static final String NAME_MAX_RETRY_COUNT = "maxRetryCount" ;
51- public static final int DEFAULT_INITIAL_RETRY_DURATION_SECONDS = 5 ;
52- public static final int DEFAULT_MAX_RETRY_COUNT = 5 ;
53- public static final int DEFAULT_MAX_RETRY_DURATION_SECONDS = 80 ;
5449 public static final String TRANSACTION_ISOLATION_LEVEL = "transactionIsolationLevel" ;
5550
5651 @ Name (JDBC_PLUGIN_NAME )
@@ -78,35 +73,35 @@ public abstract class ConnectionConfig extends PluginConfig implements DatabaseC
7873 @ Macro
7974 public String connectionArguments ;
8075
81- @ Name (NAME_INITIAL_RETRY_DURATION )
76+ @ Name (RetryUtils . NAME_INITIAL_RETRY_DURATION )
8277 @ Description ("Time taken for the first retry. Default is 5 seconds." )
8378 @ Nullable
8479 @ Macro
8580 private Integer initialRetryDuration ;
8681
87- @ Name (NAME_MAX_RETRY_DURATION )
82+ @ Name (RetryUtils . NAME_MAX_RETRY_DURATION )
8883 @ Description ("Maximum time in seconds retries can take. Default is 80 seconds." )
8984 @ Nullable
9085 @ Macro
9186 private Integer maxRetryDuration ;
9287
93- @ Name (NAME_MAX_RETRY_COUNT )
88+ @ Name (RetryUtils . NAME_MAX_RETRY_COUNT )
9489 @ Description ("Maximum number of retries allowed. Default is 5." )
9590 @ Nullable
9691 @ Macro
9792 private Integer maxRetryCount ;
9893
9994
10095 public Integer getInitialRetryDuration () {
101- return initialRetryDuration == null ? DEFAULT_INITIAL_RETRY_DURATION_SECONDS : initialRetryDuration ;
96+ return initialRetryDuration == null ? RetryUtils . DEFAULT_INITIAL_RETRY_DURATION_SECONDS : initialRetryDuration ;
10297 }
10398
10499 public Integer getMaxRetryDuration () {
105- return maxRetryDuration == null ? DEFAULT_MAX_RETRY_DURATION_SECONDS : maxRetryDuration ;
100+ return maxRetryDuration == null ? RetryUtils . DEFAULT_MAX_RETRY_DURATION_SECONDS : maxRetryDuration ;
106101 }
107102
108103 public Integer getMaxRetryCount () {
109- return maxRetryCount == null ? DEFAULT_MAX_RETRY_COUNT : maxRetryCount ;
104+ return maxRetryCount == null ? RetryUtils . DEFAULT_MAX_RETRY_COUNT : maxRetryCount ;
110105 }
111106
112107 public ConnectionConfig () {
0 commit comments