mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
ha support
This commit is contained in:
@@ -181,6 +181,10 @@ public abstract class MultiDataSource extends DataSourceAdapter implements Multi
|
||||
public void handleNotAwailableDatasource(DataSourceHolder dataSourceHolder) {
|
||||
dataSourceHolder.setEnable(false);
|
||||
}
|
||||
|
||||
public String[] getDataSourceNames() {
|
||||
return this.dataSources.keySet().toArray(new String[this.dataSources.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDbType() {
|
||||
@@ -216,6 +220,16 @@ public abstract class MultiDataSource extends DataSourceAdapter implements Multi
|
||||
public long createTransactionId() {
|
||||
return transactionIdSeed.incrementAndGet();
|
||||
}
|
||||
|
||||
public boolean restartDataSource(String name) {
|
||||
DataSourceHolder holder = this.getDataSources().get(name);
|
||||
if (holder != null) {
|
||||
holder.restart();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
class FailureDetectTask implements Runnable {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user