use of org.jboss.jca.core.spi.transaction.recovery.XAResourceRecoveryRegistry in project wildfly by wildfly.
the class AbstractResourceAdapterDeploymentService method unregisterAll.
public void unregisterAll(String deploymentName) {
if (value != null) {
DEPLOYMENT_CONNECTOR_LOGGER.debugf("Unregistering: %s", deploymentName);
if (registry != null && registry.getValue() != null) {
registry.getValue().unregisterResourceAdapterDeployment(value);
}
if (managementRepository != null && managementRepository.getValue() != null && value.getDeployment() != null && value.getDeployment().getConnector() != null) {
managementRepository.getValue().getConnectors().remove(value.getDeployment().getConnector());
}
if (mdr != null && mdr.getValue() != null && value.getDeployment() != null && value.getDeployment().getCfs() != null && value.getDeployment().getCfJndiNames() != null) {
for (int i = 0; i < value.getDeployment().getCfs().length; i++) {
try {
String cf = value.getDeployment().getCfs()[i].getClass().getName();
String jndi = value.getDeployment().getCfJndiNames()[i];
mdr.getValue().unregisterJndiMapping(value.getDeployment().getURL().toExternalForm(), cf, jndi);
} catch (Throwable nfe) {
DEPLOYMENT_CONNECTOR_LOGGER.debug("Exception during JNDI unbinding", nfe);
}
}
}
if (mdr != null && mdr.getValue() != null && value.getDeployment().getAos() != null && value.getDeployment().getAoJndiNames() != null) {
for (int i = 0; i < value.getDeployment().getAos().length; i++) {
try {
String ao = value.getDeployment().getAos()[i].getClass().getName();
String jndi = value.getDeployment().getAoJndiNames()[i];
mdr.getValue().unregisterJndiMapping(value.getDeployment().getURL().toExternalForm(), ao, jndi);
} catch (Throwable nfe) {
DEPLOYMENT_CONNECTOR_LOGGER.debug("Exception during JNDI unbinding", nfe);
}
}
}
if (value != null && value.getDeployment() != null && value.getDeployment().getRecovery() != null && txInt != null && txInt.getValue() != null) {
XAResourceRecoveryRegistry rr = txInt.getValue().getRecoveryRegistry();
if (rr != null) {
for (XAResourceRecovery recovery : value.getDeployment().getRecovery()) {
if (recovery != null) {
try {
recovery.shutdown();
} catch (Exception e) {
DEPLOYMENT_CONNECTOR_LOGGER.errorDuringRecoveryShutdown(e);
} finally {
rr.removeXAResourceRecovery(recovery);
}
}
}
}
}
if (value.getDeployment() != null && value.getDeployment().getConnectionManagers() != null) {
for (ConnectionManager cm : value.getDeployment().getConnectionManagers()) {
cm.shutdown();
}
}
if (value.getDeployment() != null && value.getDeployment().getResourceAdapter() != null) {
ClassLoader old = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(value.getDeployment().getResourceAdapter().getClass().getClassLoader());
value.getDeployment().getResourceAdapter().stop();
} catch (Throwable nfe) {
DEPLOYMENT_CONNECTOR_LOGGER.errorStoppingRA(nfe);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(old);
}
}
if (value.getDeployment() != null && value.getDeployment().getBootstrapContextIdentifier() != null) {
BootstrapContextCoordinator.getInstance().removeBootstrapContext(value.getDeployment().getBootstrapContextIdentifier());
}
}
if (raRepositoryRegistrationId != null && raRepository != null && raRepository.getValue() != null) {
try {
raRepository.getValue().unregisterResourceAdapter(raRepositoryRegistrationId);
} catch (Throwable e) {
DEPLOYMENT_CONNECTOR_LOGGER.debug("Failed to unregister RA from RA Repository", e);
}
}
if (connectorServicesRegistrationName != null) {
try {
ConnectorServices.unregisterResourceAdapterIdentifier(connectorServicesRegistrationName);
} catch (Throwable e) {
DEPLOYMENT_CONNECTOR_LOGGER.debug("Failed to unregister RA from ConnectorServices", e);
}
}
if (mdrRegistrationName != null && mdr != null && mdr.getValue() != null) {
try {
mdr.getValue().unregisterResourceAdapter(mdrRegistrationName);
} catch (Throwable e) {
DEPLOYMENT_CONNECTOR_LOGGER.debug("Failed to unregister RA from MDR", e);
}
}
}
Aggregations