in jdbc/src/main/java/software/amazon/timestream/jdbc/TimestreamConnection.java [661:713]
private void configureSdkOptions(
final Properties info,
final ClientConfiguration clientConfiguration) throws SQLException {
try {
final int requestTimeout = Integer.parseInt(info
.getOrDefault(
TimestreamConnectionProperty.REQUEST_TIMEOUT.getConnectionProperty(),
TimestreamConnectionProperty.REQUEST_TIMEOUT.getDefaultValue())
.toString());
final int socketTimeout = Integer.parseInt(info
.getOrDefault(
TimestreamConnectionProperty.SOCKET_TIMEOUT.getConnectionProperty(),
TimestreamConnectionProperty.SOCKET_TIMEOUT.getDefaultValue())
.toString());
if (socketTimeout < 0) {
throw Error.createSQLException(LOGGER, Error.INVALID_TIMEOUT, socketTimeout);
}
final int maxConnections = Integer.parseInt(info
.getOrDefault(
TimestreamConnectionProperty.MAX_CONNECTIONS.getConnectionProperty(),
TimestreamConnectionProperty.MAX_CONNECTIONS.getDefaultValue())
.toString());
if (maxConnections < 0) {
throw Error.createSQLException(LOGGER, Error.INVALID_MAX_CONNECTIONS, maxConnections);
}
final String maxRetryCount = info
.getOrDefault(
TimestreamConnectionProperty.MAX_RETRY_COUNT.getConnectionProperty(),
TimestreamConnectionProperty.MAX_RETRY_COUNT.getDefaultValue())
.toString();
if (!maxRetryCount.isEmpty()) {
final int maxRetryCountClient = Integer.parseInt(maxRetryCount);
if (maxRetryCountClient < 0) {
throw Error.createSQLException(LOGGER, Error.INVALID_MAX_RETRY_COUNT, maxRetryCountClient);
}
clientConfiguration.withMaxErrorRetry(maxRetryCountClient);
}
clientConfiguration
.withRequestTimeout(requestTimeout)
.withSocketTimeout(socketTimeout)
.withMaxConnections(maxConnections);
} catch (final NumberFormatException ne) {
throw Error.createSQLException(LOGGER, Constants.CONNECTION_EXCEPTION_SQL_STATE, ne, Error.INVALID_NUMERIC_CONNECTION_VALUE);
}
}