Skip to content

Commit b35d7e8

Browse files
committed
Use standard getters/setters for DataSourceAlert and DataSourceListener
1 parent 8747f8c commit b35d7e8

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

src/main/java/org/avaje/datasource/Factory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public class Factory implements DataSourceFactory {
99

1010
@Override
11-
public DataSourcePool createPool(String name, DataSourceConfig config, DataSourceAlert alert, DataSourcePoolListener listener) {
12-
return new ConnectionPool(name, config, alert, listener);
11+
public DataSourcePool createPool(String name, DataSourceConfig config) {
12+
return new ConnectionPool(name, config);
1313
}
1414
}

src/main/java/org/avaje/datasource/pool/ConnectionPool.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,10 @@ public class ConnectionPool implements DataSourcePool {
171171
private long leakTimeMinutes;
172172

173173
public ConnectionPool(String name, DataSourceConfig params) {
174-
this(name, params, null, null);
175-
}
176-
177-
public ConnectionPool(String name, DataSourceConfig params, DataSourceAlert notify, DataSourcePoolListener listener) {
178174

179-
this.notify = notify;
180175
this.name = name;
181-
this.poolListener = listener;
176+
this.notify = params.getAlert();
177+
this.poolListener = params.getListener();
182178

183179
this.autoCommit = params.isAutoCommit();
184180
this.transactionIsolation = params.getIsolationLevel();

src/test/java/org/avaje/datasource/FactoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public void createPool() throws Exception {
1818
config.setUsername("sa");
1919
config.setPassword("");
2020

21-
DataSourcePool pool = factory.createPool("test", config, null, null);
21+
DataSourcePool pool = factory.createPool("test", config);
2222

2323
Connection connection = pool.getConnection();
2424

0 commit comments

Comments
 (0)