in tx-control-providers/jdbc/tx-control-provider-jdbc-local/src/main/java/org/apache/aries/tx/control/jdbc/local/impl/ManagedServiceFactoryImpl.java [168:195]
private void updateService(DataSourceFactory service) {
boolean setDsf;
synchronized (this) {
setDsf = activeDsf.compareAndSet(null, service);
}
if (setDsf) {
AbstractJDBCConnectionProvider provider = null;
ServiceRegistration<JDBCConnectionProvider> reg = null;
try {
provider = new JDBCConnectionProviderFactoryImpl().getProviderFor(service,
jdbcProperties, providerProperties);
reg = context.registerService(JDBCConnectionProvider.class,
provider, getServiceProperties());
synchronized (this) {
if (!serviceReg.compareAndSet(null, reg)) {
throw new IllegalStateException("Unable to set the JDBC connection provider registration");
} else {
providerObject.set(provider);
}
}
} catch (Exception e) {
activeDsf.compareAndSet(service, null);
safeUnregister(reg, provider);
LOG.error("An error occurred when creating the connection provider for {}.", pid, e);
}
}
}