Skip to content

Commit 2673481

Browse files
committed
#36 - Simplify remove deregister driver option for shutdown method
1 parent 0eb11be commit 2673481

7 files changed

Lines changed: 7 additions & 34 deletions

File tree

src/main/java/io/ebean/datasource/DataSourcePool.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ public interface DataSourcePool extends DataSource {
4444
*/
4545
void shutdown();
4646

47-
/**
48-
* Shutdown the pool with the option to deregister the driver.
49-
*/
50-
void shutdown(boolean deregisterDriver);
51-
5247
/**
5348
* Return the current status of the connection pool.
5449
* <p>

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

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -789,11 +789,6 @@ public void testAlert() {
789789
}
790790
}
791791

792-
@Override
793-
public void shutdown() {
794-
shutdown(false);
795-
}
796-
797792
/**
798793
* This will close all the free connections, and then go into a wait loop,
799794
* waiting for the busy connections to be freed.
@@ -802,11 +797,8 @@ public void shutdown() {
802797
* Connections are not waited on, as that would hang the server.
803798
*/
804799
@Override
805-
public void shutdown(boolean deregisterDriver) {
800+
public void shutdown() {
806801
shutdownPool(true);
807-
if (deregisterDriver) {
808-
deregisterDriver();
809-
}
810802
}
811803

812804
@Override
@@ -985,20 +977,6 @@ public PoolStatus getStatus(boolean reset) {
985977
return queue.getStatus(reset);
986978
}
987979

988-
/**
989-
* Deregister the JDBC driver.
990-
*/
991-
private void deregisterDriver() {
992-
if (hasDriver()) {
993-
try {
994-
logger.debug("Deregister the JDBC driver " + driver);
995-
DriverManager.deregisterDriver(DriverManager.getDriver(url));
996-
} catch (SQLException e) {
997-
logger.warn("Error trying to deregister the JDBC driver " + driver, e);
998-
}
999-
}
1000-
}
1001-
1002980
public static class Status implements PoolStatus {
1003981

1004982
private final int minSize;

src/test/java/io/ebean/datasource/core/DataSourcePoolFactoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ public void createPool() throws Exception {
2727
}
2828
}
2929

30-
pool.shutdown(false);
30+
pool.shutdown();
3131
}
3232
}

src/test/java/io/ebean/datasource/pool/ConnectionPoolInterruptTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private ConnectionPool createPool() {
3131

3232
@AfterClass
3333
public void after() {
34-
pool.shutdown(false);
34+
pool.shutdown();
3535
}
3636

3737
@Test

src/test/java/io/ebean/datasource/pool/ConnectionPoolSpeedTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private ConnectionPool createPool() {
4141

4242
@AfterClass
4343
public void after() {
44-
pool.shutdown(false);
44+
pool.shutdown();
4545
}
4646

4747
@Test

src/test/java/io/ebean/datasource/pool/ConnectionPoolTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private ConnectionPool createPool() {
3333

3434
@AfterClass
3535
public void after() {
36-
pool.shutdown(false);
36+
pool.shutdown();
3737
}
3838

3939
@Test

src/test/java/io/ebean/datasource/pool/ConnectionPoolTrimIdleTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void test() throws SQLException, InterruptedException {
5050
assertThat(pool.getStatus(false).getFree()).isEqualTo(1);
5151

5252
} finally {
53-
pool.shutdown(false);
53+
pool.shutdown();
5454
}
5555
}
5656

@@ -90,7 +90,7 @@ public void test_withDecreasingActivity_expect_trimToActivityLevel() throws SQLE
9090
assertThat(pool.getStatus(false).getFree()).isEqualTo(1);
9191

9292
} finally {
93-
pool.shutdown(false);
93+
pool.shutdown();
9494
}
9595
}
9696

0 commit comments

Comments
 (0)