Skip to content

Commit c656973

Browse files
committed
Fixing checkstyle and spotbug errors.
1 parent bd6a3b0 commit c656973

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreMySQLImpl.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@
5757
*/
5858
public class StateStoreMySQLImpl extends StateStoreSerializableImpl {
5959
public static final String SQL_STATE_STORE_CONF_PREFIX = "state-store-mysql.";
60-
public static String CONNECTION_URL = SQL_STATE_STORE_CONF_PREFIX + "connection.url";
61-
public static String CONNECTION_USERNAME = SQL_STATE_STORE_CONF_PREFIX + "connection.username";
62-
public static String CONNECTION_PASSWORD = SQL_STATE_STORE_CONF_PREFIX + "connection.password";
63-
public static String CONNECTION_DRIVER = SQL_STATE_STORE_CONF_PREFIX + "connection.driver";
60+
public static final String CONNECTION_URL = SQL_STATE_STORE_CONF_PREFIX + "connection.url";
61+
public static final String CONNECTION_USERNAME = SQL_STATE_STORE_CONF_PREFIX + "connection.username";
62+
public static final String CONNECTION_PASSWORD = SQL_STATE_STORE_CONF_PREFIX + "connection.password";
63+
public static final String CONNECTION_DRIVER = SQL_STATE_STORE_CONF_PREFIX + "connection.driver";
6464

6565
private static final Logger LOG =
6666
LoggerFactory.getLogger(StateStoreSerializableImpl.class);
@@ -132,16 +132,14 @@ public <T extends BaseRecord> QueryResult<T> get(Class<T> clazz)
132132
long start = monotonicNow();
133133
StateStoreMetrics metrics = getMetrics();
134134
List<T> ret = new ArrayList<>();
135-
try {
136-
try (Connection connection = connectionFactory.getConnection()){
137-
PreparedStatement statement = connection.prepareStatement(
138-
String.format("SELECT * FROM %s", tableName));
139-
try (ResultSet result = statement.executeQuery()) {
140-
while(result.next()) {
141-
String recordValue = result.getString("recordValue");
142-
T record = newRecord(recordValue, clazz, false);
143-
ret.add(record);
144-
}
135+
try (Connection connection = connectionFactory.getConnection();
136+
PreparedStatement statement = connection.prepareStatement(
137+
String.format("SELECT * FROM %s", tableName))) {
138+
try (ResultSet result = statement.executeQuery()) {
139+
while(result.next()) {
140+
String recordValue = result.getString("recordValue");
141+
T record = newRecord(recordValue, clazz, false);
142+
ret.add(record);
145143
}
146144
}
147145
} catch (Exception e) {
@@ -395,7 +393,7 @@ static class MySQLStateStoreHikariDataSourceConnectionFactory
395393
+ "connection.hikari.";
396394
private final HikariDataSource dataSource;
397395

398-
public MySQLStateStoreHikariDataSourceConnectionFactory(Configuration conf) {
396+
MySQLStateStoreHikariDataSourceConnectionFactory(Configuration conf) {
399397
Properties properties = new Properties();
400398
properties.setProperty("jdbcUrl", conf.get(StateStoreMySQLImpl.CONNECTION_URL));
401399
properties.setProperty("username", conf.get(StateStoreMySQLImpl.CONNECTION_USERNAME));

hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/resources/hdfs-rbf-default.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,8 @@
362362
Class to implement the State Store. There are three implementation classes currently
363363
being supported:
364364
org.apache.hadoop.hdfs.server.federation.store.driver.impl.StateStoreFileImpl,
365-
org.apache.hadoop.hdfs.server.federation.store.driver.impl.StateStoreFileSystemImpl and
365+
org.apache.hadoop.hdfs.server.federation.store.driver.impl.StateStoreFileSystemImpl,
366+
org.apache.hadoop.hdfs.server.federation.store.driver.impl.StateStoreMySQLImpl and
366367
org.apache.hadoop.hdfs.server.federation.store.driver.impl.StateStoreZooKeeperImpl.
367368
These implementation classes use the local file, filesystem and ZooKeeper as a backend respectively.
368369
By default it uses the ZooKeeper as the default State Store.

0 commit comments

Comments
 (0)