use of lucee.runtime.db.DatasourceConnectionPool in project Lucee by lucee.
the class DatasourceStorageScopeCleaner method clean.
private void clean(ConfigWeb config, DataSource dataSource) throws PageException, SQLException {
ConfigWebImpl cwi = (ConfigWebImpl) config;
DatasourceConnection dc = null;
DatasourceConnectionPool pool = cwi.getDatasourceConnectionPool();
try {
dc = pool.getDatasourceConnection(null, dataSource, null, null);
Log log = ((ConfigImpl) config).getLog("scope");
SQLExecutor executor = SQLExecutionFactory.getInstance(dc);
executor.clean(config, dc, type, engine, this, listener, log);
} finally {
if (dc != null)
pool.releaseDatasourceConnection(dc);
}
}
use of lucee.runtime.db.DatasourceConnectionPool in project Lucee by lucee.
the class StorageScopeDatasource method store.
@Override
public void store(PageContext pc) {
DatasourceConnection dc = null;
ConfigImpl ci = (ConfigImpl) ThreadLocalPageContext.getConfig(pc);
DatasourceConnectionPool pool = ci.getDatasourceConnectionPool();
Log log = ci.getLog("scope");
try {
// FUTURE change method interface
pc = ThreadLocalPageContext.get(pc);
DataSource ds;
if (pc != null)
ds = pc.getDataSource(datasourceName);
else
ds = ci.getDataSource(datasourceName);
dc = pool.getDatasourceConnection(null, ds, null, null);
SQLExecutor executor = SQLExecutionFactory.getInstance(dc);
executor.update(ci, cfid, appName, dc, getType(), sct, getTimeSpan(), log);
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
ScopeContext.error(log, t);
} finally {
if (dc != null)
pool.releaseDatasourceConnection(dc);
}
}
use of lucee.runtime.db.DatasourceConnectionPool in project Lucee by lucee.
the class GetSystemInfo method getConnections.
public static int getConnections(ConfigWebImpl config) {
int count = 0;
DatasourceConnectionPool pool = config.getDatasourceConnectionPool();
Iterator<Integer> it = pool.openConnections().values().iterator();
Integer i;
while (it.hasNext()) {
i = it.next();
if (i != null)
count += i.intValue();
}
return count;
}
Aggregations