use of io.mycat.proxy.MySQLDatasourcePool in project Mycat2 by MyCATApache.
the class NativeDatasourcePoolImpl method getAvailableNumber.
@Override
public Integer getAvailableNumber() {
NativeMycatServer nativeMycatServer = MetaClusterCurrent.wrapper(NativeMycatServer.class);
MySQLDatasourcePool sqlDatasourcePool = nativeMycatServer.getDatasource(targetName);
return sqlDatasourcePool.getSessionLimitCount() - sqlDatasourcePool.currentSessionCount();
}
use of io.mycat.proxy.MySQLDatasourcePool in project Mycat2 by MyCATApache.
the class NativeDatasourcePoolImpl method close.
@Override
public void close() {
NativeMycatServer nativeMycatServer = MetaClusterCurrent.wrapper(NativeMycatServer.class);
MySQLDatasourcePool sqlDatasourcePool = nativeMycatServer.getDatasource(targetName);
sqlDatasourcePool.close();
}
use of io.mycat.proxy.MySQLDatasourcePool in project Mycat2 by MyCATApache.
the class NativeDatasourcePoolImpl method getUsedNumber.
@Override
public Integer getUsedNumber() {
NativeMycatServer nativeMycatServer = MetaClusterCurrent.wrapper(NativeMycatServer.class);
MySQLDatasourcePool sqlDatasourcePool = nativeMycatServer.getDatasource(targetName);
return sqlDatasourcePool.currentSessionCount();
}
use of io.mycat.proxy.MySQLDatasourcePool in project Mycat2 by MyCATApache.
the class NativeMycatServer method getDatasource.
public MySQLDatasourcePool getDatasource(String name) {
MySQLDatasourcePool datasource = datasourceMap.get(name);
if (datasource != null) {
return datasource;
}
DatasourceConfig datasourceConfig = Objects.requireNonNull(datasourceConfigProvider.get()).get(name);
if (datasourceConfig != null && "mysql".equalsIgnoreCase(datasourceConfig.getDbType())) {
return datasourceMap.computeIfAbsent(name, s -> {
MySQLDatasourcePool mySQLDatasource = new MySQLDatasourcePool(name, datasourceConfigProvider, this);
return mySQLDatasource;
});
}
return null;
}
Aggregations