|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.jdbc.datasource.DelegatingDataSource
com.jolbox.bonecp.spring.DynamicDataSourceProxy
public class DynamicDataSourceProxy
Like a normal datasource except it supports an extra method: switchDataSource to slowly migrate to a new datasource. Simply call switchDataSource with your new BoneCP configuration: the existing pool will be shutdown gracefully (checkout out connections are unaffected) and a new one will take it's place. A typical use case would be to transparently instruct your application to use a new database without restarting the application.
| Constructor Summary | |
|---|---|
DynamicDataSourceProxy()
Default constructor. |
|
DynamicDataSourceProxy(DataSource targetDataSource)
Create a new DynamicDataSourceProxy. |
|
| Method Summary | |
|---|---|
void |
switchDataSource(BoneCPConfig newConfig)
Switch to a new DataSource using the given configuration. |
| Methods inherited from class org.springframework.jdbc.datasource.DelegatingDataSource |
|---|
afterPropertiesSet, getConnection, getConnection, getLoginTimeout, getLogWriter, getTargetDataSource, isWrapperFor, setLoginTimeout, setLogWriter, setTargetDataSource, unwrap |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DynamicDataSourceProxy(DataSource targetDataSource)
targetDataSource - the target DataSourcepublic DynamicDataSourceProxy()
| Method Detail |
|---|
public void switchDataSource(BoneCPConfig newConfig)
throws SQLException
newConfig - BoneCP DataSource to use.
SQLException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||