mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
ha
This commit is contained in:
@@ -30,7 +30,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import javax.management.ObjectName;
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.Reference;
|
||||
import javax.naming.Referenceable;
|
||||
|
||||
@@ -87,6 +87,12 @@ public class HADataSource extends MultiDataSource implements HADataSourceMBean,
|
||||
|
||||
slave.setEnable(value);
|
||||
}
|
||||
|
||||
public void switchMasterSlave() {
|
||||
DruidDataSource tmp = this.getMaster();
|
||||
this.setMaster(this.getSlave());
|
||||
this.setSlave(tmp);
|
||||
}
|
||||
|
||||
public synchronized void setDataSources(List<DruidDataSource> dataSources) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
package com.alibaba.druid.pool.ha;
|
||||
|
||||
public interface HADataSourceMBean {
|
||||
long getMasterConnectCount();
|
||||
|
||||
long getSlaveConnectCount();
|
||||
long getMasterConnectCount();
|
||||
|
||||
boolean isMasterEnable();
|
||||
long getSlaveConnectCount();
|
||||
|
||||
void setMasterEnable(boolean value);
|
||||
boolean isMasterEnable();
|
||||
|
||||
boolean isSlaveEnable();
|
||||
|
||||
void setSlaveEnable(boolean value);
|
||||
|
||||
void resetStat();
|
||||
void setMasterEnable(boolean value);
|
||||
|
||||
boolean isSlaveEnable();
|
||||
|
||||
void setSlaveEnable(boolean value);
|
||||
|
||||
void switchMasterSlave();
|
||||
|
||||
void resetStat();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user