Skip to content

Commit 2997640

Browse files
committed
Refactor internals only - refactor rename url and driver
1 parent 461f3f0 commit 2997640

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ public class ConnectionPool implements DataSourcePool {
7272
/**
7373
* The jdbc connection url.
7474
*/
75-
private final String databaseUrl;
75+
private final String url;
7676

7777
/**
7878
* The jdbc driver.
7979
*/
80-
private final String databaseDriver;
80+
private final String driver;
8181

8282
/**
8383
* The sql used to test a connection.
@@ -202,8 +202,8 @@ public ConnectionPool(String name, DataSourceConfig params) {
202202
this.leakTimeMinutes = params.getLeakTimeMinutes();
203203
this.captureStackTrace = params.isCaptureStackTrace();
204204
this.maxStackTraceSize = params.getMaxStackTraceSize();
205-
this.databaseDriver = params.getDriver();
206-
this.databaseUrl = params.getUrl();
205+
this.driver = params.getDriver();
206+
this.url = params.getUrl();
207207
this.pstmtCacheSize = params.getPstmtCacheSize();
208208
this.minConnections = params.getMinConnections();
209209
this.maxConnections = params.getMaxConnections();
@@ -266,20 +266,20 @@ public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedE
266266
* Return true if driver has been explicitly configured.
267267
*/
268268
private boolean hasDriver() {
269-
return databaseDriver != null && !databaseDriver.isEmpty();
269+
return driver != null && !driver.isEmpty();
270270
}
271271

272272
private void checkDriver() {
273273
if (hasDriver()) {
274274
try {
275275
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
276276
if (contextLoader != null) {
277-
Class.forName(databaseDriver, true, contextLoader);
277+
Class.forName(driver, true, contextLoader);
278278
} else {
279-
Class.forName(databaseDriver, true, this.getClass().getClassLoader());
279+
Class.forName(driver, true, this.getClass().getClassLoader());
280280
}
281281
} catch (Throwable e) {
282-
throw new IllegalStateException("Problem loading Database Driver [" + this.databaseDriver + "]: " + e.getMessage(), e);
282+
throw new IllegalStateException("Problem loading Database Driver [" + driver + "]: " + e.getMessage(), e);
283283
}
284284
}
285285
}
@@ -514,7 +514,7 @@ public Connection createUnpooledConnection() throws SQLException {
514514

515515
private Connection createUnpooledConnection(Properties properties, boolean notifyIsDown) throws SQLException {
516516
try {
517-
Connection conn = DriverManager.getConnection(databaseUrl, properties);
517+
Connection conn = DriverManager.getConnection(url, properties);
518518
initConnection(conn);
519519
return conn;
520520
} catch (SQLException ex) {
@@ -900,7 +900,7 @@ public Connection getConnection(String username, String password) throws SQLExce
900900
props.putAll(connectionProps);
901901
props.setProperty("user", username);
902902
props.setProperty("password", password);
903-
Connection conn = DriverManager.getConnection(databaseUrl, props);
903+
Connection conn = DriverManager.getConnection(url, props);
904904
initConnection(conn);
905905
return conn;
906906
}
@@ -991,10 +991,10 @@ public PoolStatus getStatus(boolean reset) {
991991
private void deregisterDriver() {
992992
if (hasDriver()) {
993993
try {
994-
logger.debug("Deregister the JDBC driver " + databaseDriver);
995-
DriverManager.deregisterDriver(DriverManager.getDriver(databaseUrl));
994+
logger.debug("Deregister the JDBC driver " + driver);
995+
DriverManager.deregisterDriver(DriverManager.getDriver(url));
996996
} catch (SQLException e) {
997-
logger.warn("Error trying to deregister the JDBC driver " + databaseDriver, e);
997+
logger.warn("Error trying to deregister the JDBC driver " + driver, e);
998998
}
999999
}
10001000
}

0 commit comments

Comments
 (0)