Skip to content

Commit a515357

Browse files
committed
Fix smell with incrementation
1 parent 6aae5be commit a515357

File tree

1 file changed

+13
-9
lines changed
  • Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql

1 file changed

+13
-9
lines changed

Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/MySQLDB.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ public MySQLDB(Supplier<Locale> locale) {
2929
super(locale);
3030
}
3131

32+
private static synchronized void increment() {
33+
increment++;
34+
}
35+
36+
/**
37+
* @return the name of the Database
38+
*/
39+
@Override
40+
public String getName() {
41+
return "MySQL";
42+
}
43+
3244
/**
3345
* Setups the {@link HikariDataSource}
3446
*/
@@ -55,7 +67,7 @@ public void setupDataSource() throws DBInitException {
5567

5668
config.setPoolName("Plan Connection Pool-" + increment);
5769
config.setDriverClassName("com.mysql.jdbc.Driver");
58-
increment++;
70+
increment();
5971

6072
config.setAutoCommit(true);
6173
config.setMaximumPoolSize(8);
@@ -69,14 +81,6 @@ public void setupDataSource() throws DBInitException {
6981
}
7082
}
7183

72-
/**
73-
* @return the name of the Database
74-
*/
75-
@Override
76-
public String getName() {
77-
return "MySQL";
78-
}
79-
8084
@Override
8185
public Connection getConnection() throws SQLException {
8286
Connection connection = dataSource.getConnection();

0 commit comments

Comments
 (0)