Skip to content

Commit

Permalink
Don't re-initialize JDBC if no real change was made to the configurat…
Browse files Browse the repository at this point in the history
…ion.
  • Loading branch information
nmihajlovski committed Dec 11, 2016
1 parent 69f8136 commit 2c3bda3
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions rapidoid-sql/src/main/java/org/rapidoid/jdbc/JdbcClient.java
Expand Up @@ -44,32 +44,44 @@ public class JdbcClient extends RapidoidThing {
private volatile ConnectionPool pool = new NoConnectionPool(); private volatile ConnectionPool pool = new NoConnectionPool();


public synchronized JdbcClient username(String username) { public synchronized JdbcClient username(String username) {
this.username = username; if (U.neq(this.username, username)) {
this.initialized = false; this.username = username;
this.initialized = false;
}
return this; return this;
} }


public synchronized JdbcClient password(String password) { public synchronized JdbcClient password(String password) {
this.password = password; if (U.neq(this.password, password)) {
this.initialized = false; this.password = password;
this.initialized = false;
}
return this; return this;
} }


public synchronized JdbcClient driver(String driver) { public synchronized JdbcClient driver(String driver) {
this.driver = driver; if (U.neq(this.driver, driver)) {
this.initialized = false; this.driver = driver;
this.initialized = false;
}
return this; return this;
} }


public synchronized JdbcClient pool(ConnectionPool connectionPool) { public synchronized JdbcClient pool(ConnectionPool pool) {
this.pool = connectionPool; if (U.neq(this.pool, pool)) {
this.initialized = false; this.pool = pool;
this.initialized = false;
}
return this; return this;
} }


public synchronized JdbcClient url(String url) { public synchronized JdbcClient url(String url) {
this.url = url; if (U.neq(this.url, url)) {
this.initialized = false; this.url = url;
this.initialized = false;
}
return this;
}
return this; return this;
} }


Expand Down

0 comments on commit 2c3bda3

Please sign in to comment.