git-svn-id: http://code.alibabatech.com/svn/druid/trunk@249 b9813039-fb51-4c41-a8b9-e21c2acb5095

This commit is contained in:
wenshao
2011-06-02 13:21:28 +00:00
parent 163b4f8a48
commit 5bbf9566c8
@@ -12,8 +12,8 @@ public class HADataSource implements DataSource {
private final List<DataSource> dataSources = new CopyOnWriteArrayList<DataSource>();
private int loginTimeout = 0;
private PrintWriter logWriter = new PrintWriter(System.out);
private int loginTimeout = 0;
private PrintWriter logWriter = new PrintWriter(System.out);
public List<DataSource> getDataSources() {
return dataSources;
@@ -40,13 +40,30 @@ public class HADataSource implements DataSource {
}
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
return null;
public boolean isWrapperFor(Class<?> iface) throws SQLException {
if (iface == null) {
return false;
}
if (iface.isInstance(this)) {
return true;
}
return false;
}
@SuppressWarnings("unchecked")
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return false;
public <T> T unwrap(Class<T> iface) throws SQLException {
if (iface == null) {
return null;
}
if (iface.isInstance(this)) {
return (T) this;
}
return null;
}
@Override
@@ -56,7 +73,7 @@ public class HADataSource implements DataSource {
@Override
public Connection getConnection(String username, String password) throws SQLException {
return null;
throw new UnsupportedOperationException();
}
}