mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
ha
This commit is contained in:
@@ -99,7 +99,7 @@ public class HADataSource extends MultiDataSource implements HADataSourceMBean,
|
||||
masterConnectCount.incrementAndGet();
|
||||
}
|
||||
|
||||
if (slave.isEnable()) {
|
||||
if (conn == null && slave.isEnable()) {
|
||||
conn = slave.getConnection();
|
||||
slaveConnectCount.incrementAndGet();
|
||||
}
|
||||
|
||||
@@ -579,6 +579,26 @@ public class MultiDataSourceConnection extends WrapperAdapter implements Connect
|
||||
public Date getConnectedTime() {
|
||||
return connectedTime;
|
||||
}
|
||||
|
||||
public boolean isWrapperFor(Class<?> iface) throws SQLException {
|
||||
boolean result = super.isWrapperFor(iface);
|
||||
|
||||
if (result == false && conn != null) {
|
||||
result = conn.isWrapperFor(iface);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public <T> T unwrap(Class<T> iface) throws SQLException {
|
||||
T object = super.unwrap(iface);
|
||||
|
||||
if (object == null && conn != null) {
|
||||
object = conn.unwrap(iface);
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
public void setSchema(String schema) throws SQLException {
|
||||
throw new SQLFeatureNotSupportedException();
|
||||
|
||||
Reference in New Issue
Block a user