Methods Summary |
---|
private void | checkAndDeletePool(com.sun.enterprise.config.serverbeans.ConnectorResource cr)Checks if no more resource-refs to resources exists for the
connector connection pool and then deletes the pool
try {
String poolName = cr.getPoolName();
Resources res = (Resources) cr.parent();
boolean poolReferred =
ResourcesUtil.createInstance().isPoolReferredInServerInstance(poolName);
if (!poolReferred) {
_logger.fine("Deleting pool " + poolName + "as there is no more " +
"resource-refs to the pool in this server instance");
com.sun.enterprise.config.serverbeans.ConnectorConnectionPool ccp
= res.getConnectorConnectionPoolByName(poolName);
//Delete/Undeploy Pool
ConnectorConnectionPoolDeployer deployer =
new ConnectorConnectionPoolDeployer();
deployer.undeployResource(ccp);
}
} catch (ConfigException ce) {
_logger.warning(ce.getMessage());
_logger.fine("Exception while deleting pool : " + ce );
throw ce;
}
|
private void | createPool(com.sun.enterprise.config.serverbeans.ConnectorConnectionPool cp)
ConnectorConnectionPoolDeployer deployer =
new ConnectorConnectionPoolDeployer();
deployer.deployResource(cp);
|
public synchronized void | deployResource(java.lang.Object resource)
ConnectorResource domainResource =
(com.sun.enterprise.config.serverbeans.ConnectorResource)resource;
String jndiName = domainResource.getJndiName();
String poolName = domainResource.getPoolName();
ConnectorRuntime crt = ConnectorRuntime.getRuntime();
_logger.log(Level.FINE,
"Calling backend to add connector resource",jndiName);
// load connection pool if not loaded from the ctx in event
loadPool(domainResource);
crt.createConnectorResource(jndiName,poolName,null);
_logger.log(Level.FINE,
"Added connector resource in backend",jndiName);
|
public synchronized void | disableResource(java.lang.Object resource)
undeployResource(resource);
|
public synchronized void | enableResource(java.lang.Object resource)
deployResource(resource);
|
public java.lang.Object | getResource(java.lang.String name, com.sun.enterprise.config.serverbeans.Resources rbeans)
Object res = rbeans.getConnectorResourceByJndiName(name);
if (res == null) {
Exception ex = new Exception("No such resource");
_logger.log(Level.SEVERE,"no_resource",name);
_logger.log(Level.SEVERE,"",ex);
throw ex;
}
return res;
|
private void | loadPool(com.sun.enterprise.config.serverbeans.ConnectorResource cr)
String poolName = cr.getPoolName();
Resources resources = (Resources) cr.parent();
ConfigBean cb = resources.getConnectorConnectionPoolByName(poolName);
com.sun.enterprise.config.serverbeans.ConnectorConnectionPool cp =
(com.sun.enterprise.config.serverbeans.ConnectorConnectionPool)cb;
if (cb != null) {
if (ConnectionPoolObjectsUtils.isPoolSystemPool(poolName)){
createPool(cp);
} else {
try {
InitialContext ic = new InitialContext();
ic.lookup(ConnectorAdminServiceUtils.getReservePrefixedJNDINameForPool(poolName));
} catch (Exception e) {
// pool is not loaded
createPool(cp);
}
}
}
|
public synchronized void | redeployResource(java.lang.Object resource)
|
public synchronized void | undeployResource(java.lang.Object resource)
ConnectorResource domainResource =
(com.sun.enterprise.config.serverbeans.ConnectorResource)resource;
String jndiName = domainResource.getJndiName();
ConnectorRuntime crt = ConnectorRuntime.getRuntime();
crt.deleteConnectorResource(jndiName);
//Since 8.1 PE/SE/EE - if no more resource-ref to the pool
//of this resource in this server instance, remove pool from connector
//runtime
checkAndDeletePool(domainResource);
|