use of org.glassfish.resourcebase.resources.api.PoolInfo in project Payara by payara.
the class ConnectorConnectionPoolDeployer method undeployResource.
/**
* {@inheritDoc}
*/
public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception {
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("ConnectorConnectionPoolDeployer : undeployResource : ");
}
final org.glassfish.connectors.config.ConnectorConnectionPool domainCcp = (org.glassfish.connectors.config.ConnectorConnectionPool) resource;
PoolInfo poolInfo = new PoolInfo(domainCcp.getName(), applicationName, moduleName);
actualUndeployResource(domainCcp, poolInfo);
}
use of org.glassfish.resourcebase.resources.api.PoolInfo in project Payara by payara.
the class JdbcResourceDeployer method deployResource.
/**
* {@inheritDoc}
*/
@Override
public synchronized void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
// deployResource is not synchronized as there is only one caller
// ResourceProxy which is synchronized
JdbcResource jdbcRes = (JdbcResource) resource;
String jndiName = jdbcRes.getJndiName();
String poolName = jdbcRes.getPoolName();
PoolInfo poolInfo = new PoolInfo(poolName, applicationName, moduleName);
ResourceInfo resourceInfo = new ResourceInfo(jndiName, applicationName, moduleName);
runtime.createConnectorResource(resourceInfo, poolInfo, null);
// In-case the resource is explicitly created with a suffix (__nontx or __PM), no need to create one
if (ConnectorsUtil.getValidSuffix(jndiName) == null) {
ResourceInfo pmResourceInfo = new ResourceInfo(ConnectorsUtil.getPMJndiName(jndiName), resourceInfo.getApplicationName(), resourceInfo.getModuleName());
runtime.createConnectorResource(pmResourceInfo, poolInfo, null);
}
if (_logger.isLoggable(Level.FINEST)) {
_logger.finest("deployed resource " + jndiName);
}
}
use of org.glassfish.resourcebase.resources.api.PoolInfo in project Payara by payara.
the class JdbcConnPoolStatsProvider method decrementNumConnFreeEvent.
/**
* Decrement numconnfree event
* @param poolName
* @param steadyPoolSize
*/
@ProbeListener(JDBC_PROBE_LISTENER + "decrementNumConnFreeEvent")
public void decrementNumConnFreeEvent(@ProbeParam("poolName") String poolName, @ProbeParam("appName") String appName, @ProbeParam("moduleName") String moduleName) {
// handle the num conn free decrement event
PoolInfo poolInfo = new PoolInfo(poolName, appName, moduleName);
if (this.poolInfo.equals(poolInfo)) {
if (logger.isLoggable(Level.FINEST)) {
logger.finest("Decrement Num Connections Free event received - poolName = " + poolName);
}
// Decrement counter
synchronized (numConnFree) {
long numConnFreeSafe = (numConnFree.getCurrent() - 1 >= 0) ? numConnFree.getCurrent() - 1 : 0;
numConnFree.setCurrent(numConnFreeSafe);
}
}
}
use of org.glassfish.resourcebase.resources.api.PoolInfo in project Payara by payara.
the class JdbcConnPoolStatsProvider method connectionsFreedEvent.
/**
* Connections freed event
* @param poolName
* @param count number of connections freed to the pool
*/
@ProbeListener(JDBC_PROBE_LISTENER + "connectionsFreedEvent")
public void connectionsFreedEvent(@ProbeParam("poolName") String poolName, @ProbeParam("appName") String appName, @ProbeParam("moduleName") String moduleName, @ProbeParam("count") int count) {
// handle the connections freed event
PoolInfo poolInfo = new PoolInfo(poolName, appName, moduleName);
if (this.poolInfo.equals(poolInfo)) {
if (logger.isLoggable(Level.FINEST)) {
logger.finest("Connections Freed event received - poolName = " + poolName);
logger.finest("numConnUsed =" + numConnUsed.getCurrent() + " numConnFree=" + numConnFree.getCurrent() + " Number of connections freed =" + count);
}
// set numConnFree to the count value
synchronized (numConnFree) {
numConnFree.setCurrent(count);
}
}
}
use of org.glassfish.resourcebase.resources.api.PoolInfo in project Payara by payara.
the class GetValidationTableNames method execute.
/**
* @inheritDoc
*/
public void execute(AdminCommandContext context) {
final ActionReport report = context.getActionReport();
try {
PoolInfo poolInfo = new PoolInfo(poolName, applicationName, moduleName);
Set<String> validationTableNames = jdbcAdminService.getValidationTableNames(poolInfo);
Properties extraProperties = new Properties();
extraProperties.put("validationTableNames", new ArrayList(validationTableNames));
report.setExtraProperties(extraProperties);
} catch (Exception e) {
report.setMessage("_get-validation-table-names failed : " + e.getMessage());
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setFailureCause(e);
return;
}
ActionReport.ExitCode ec = ActionReport.ExitCode.SUCCESS;
report.setActionExitCode(ec);
}
Aggregations