*/
public void recreateConnectorConnectionPool(ConnectorConnectionPool ccp)
throws ConnectorRuntimeException {
ConnectorRegistry registry = ConnectorRegistry.getInstance();
if (registry == null) {
throw new ConnectorRuntimeException(
"Cannot get ConnectorRegistry");
}
PoolInfo poolInfo = ccp.getPoolInfo();
//First remove this pool from memory
try {
unloadAndKillPool(poolInfo);
} catch (ConnectorRuntimeException cre) {
throw cre;
}
//kill the pool
//FIXME: deleteConnectorConnectionPool should do this
//PoolManager poolManager = Switch.getSwitch().getPoolManager();
//poolManager.killPool( poolName );
//Now bind the updated pool and
//obtain a new managed connection factory for this pool
String jndiNameForPool = ConnectorAdminServiceUtils.
getReservePrefixedJNDINameForPool(poolInfo);
ManagedConnectionFactory mcf = null;
try {
_runtime.getResourceNamingService().publishObject(poolInfo, jndiNameForPool, ccp, true);
mcf = obtainManagedConnectionFactory(poolInfo);
} catch (NamingException ne) {
_logger.log(Level.SEVERE,
"rardeployment.pool_jndi_bind_failure", poolInfo);
String i18nMsg = localStrings.getString(
"ccp_adm.could_not_recreate_pool", poolInfo);
ConnectorRuntimeException crex = new ConnectorRuntimeException(i18nMsg);
crex.initCause(ne);
throw crex;
} finally{
if (mcf == null) {
try{
_runtime.getResourceNamingService().unpublishObject(poolInfo, jndiNameForPool);
}catch(NamingException e){
_logger.log(Level.WARNING,"Unable to unbind the pool configuration object " +
"of pool [ "+ poolInfo +" ] during MCF creation failure");
}
_logger.log(Level.WARNING, "rardeployment.mcf_creation_failure", poolInfo);
String i18nMsg = localStrings.getString(
"ccp_adm.failed_to_create_mcf", poolInfo);
throw new ConnectorRuntimeException(i18nMsg);
}
}
}