Skip to content

Commit 8bf0374

Browse files
committed
#33 - Refactor tidy some warnings add final etc
1 parent b7f485d commit 8bf0374

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

src/main/java/io/ebean/datasource/pool/ConnectionPool.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@ public class ConnectionPool implements DataSourcePool {
134134
/**
135135
* Synchronization monitor for the heartBeat timer.
136136
*/
137-
private Object heartBeatMonitor = new Object();
137+
private final Object heartBeatMonitor = new Object();
138138

139139
/**
140140
* HeartBeat checking will discover when it goes down, and comes back up again.
141141
*/
142-
private AtomicBoolean dataSourceUp = new AtomicBoolean(false);
142+
private final AtomicBoolean dataSourceUp = new AtomicBoolean(false);
143143

144144
/**
145145
* Stores the dataSourceDown-reason (if there is any)
@@ -149,7 +149,7 @@ public class ConnectionPool implements DataSourcePool {
149149
/**
150150
* The current alert.
151151
*/
152-
private AtomicBoolean inWarningMode = new AtomicBoolean();
152+
private final AtomicBoolean inWarningMode = new AtomicBoolean();
153153

154154
/**
155155
* The minimum number of connections this pool will maintain.

src/main/java/io/ebean/datasource/pool/PooledConnection.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,18 +333,15 @@ void returnPreparedStatement(ExtendedPreparedStatement pstmt) {
333333
* This will try to use a cache of PreparedStatements.
334334
*/
335335
public PreparedStatement prepareStatement(String sql, int returnKeysFlag) throws SQLException {
336-
String key = new StringBuilder(sql.length() + 50)
337-
.append(sql).append(':').append(currentSchema)
338-
.append(':').append(returnKeysFlag).toString();
336+
String key = sql + ':' + currentSchema + ':' + returnKeysFlag;
339337
return prepareStatement(sql, true, returnKeysFlag, key);
340338
}
341339

342340
/**
343341
* This will try to use a cache of PreparedStatements.
344342
*/
345343
public PreparedStatement prepareStatement(String sql) throws SQLException {
346-
String key = new StringBuilder(sql.length() + 50)
347-
.append(sql).append(':').append(currentSchema).toString();
344+
String key = sql + ':' + currentSchema;
348345
return prepareStatement(sql, false, 0, key);
349346
}
350347

0 commit comments

Comments
 (0)