public class MimosaDataSource extends Object implements Closeable
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DEFAULT_DS_NAME |
| 构造器和说明 |
|---|
MimosaDataSource() |
MimosaDataSource(DataSource master,
Map<String,DataSource> slaves,
String name) |
MimosaDataSource(DataSource master,
String name) |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
clearAllDataSources() |
Object |
clone() |
void |
close() |
boolean |
equals(Object obj) |
static Set<DataSource> |
getAllDataSources() |
Connection |
getConnection(boolean isMaster,
String slaveName,
boolean isIgnoreEmptySlave)
获得一个新的连接
|
DatabaseType |
getDatabaseTypeEnum() |
DataSource |
getDataSource(boolean isMaster) |
static int |
getDataSourceSize() |
String |
getDestroyMethod() |
DataSource |
getMaster() |
String |
getName() |
DataSource |
getSalveDataSource(String name,
boolean isIgnoreEmptySlave) |
Map<String,DataSource> |
getSlaves() |
boolean |
hasMaster() |
DataSource |
randomSlave(boolean isIgnoreEmptySlave) |
void |
setDestroyMethod(String destroyMethod) |
void |
setMaster(DataSource master) |
void |
setName(String name) |
void |
setSlaves(Map<String,DataSource> slaves) |
public MimosaDataSource()
public MimosaDataSource(DataSource master, String name) throws SQLException
SQLExceptionpublic MimosaDataSource(DataSource master, Map<String,DataSource> slaves, String name) throws SQLException
SQLExceptionpublic static int getDataSourceSize()
public static Set<DataSource> getAllDataSources()
public static void clearAllDataSources()
public DataSource getMaster()
public String getName()
public void setName(String name)
public void setMaster(DataSource master) throws SQLException
SQLExceptionpublic void setSlaves(Map<String,DataSource> slaves)
public Map<String,DataSource> getSlaves()
public DataSource randomSlave(boolean isIgnoreEmptySlave)
public DataSource getDataSource(boolean isMaster)
public DataSource getSalveDataSource(String name, boolean isIgnoreEmptySlave)
public Connection getConnection(boolean isMaster, String slaveName, boolean isIgnoreEmptySlave) throws SQLException
isMaster - slaveName - SQLExceptionpublic DatabaseType getDatabaseTypeEnum()
public boolean hasMaster()
public String getDestroyMethod()
public void setDestroyMethod(String destroyMethod)
public void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableIOExceptionCopyright © 2020. All rights reserved.