use of org.apache.aries.transaction.jdbc.RecoverableDataSource in project aries by apache.
the class ManagedDataSourceFactory method register.
public void register() throws Exception {
boolean isXaDataSource = (dataSource instanceof XADataSource);
Hashtable<String, Object> props = new Hashtable<String, Object>(this.properties);
props.put("aries.managed", "true");
if (isXaDataSource) {
props.put("aries.xa.aware", "true");
}
props.put("jmx.objectname", "org.apache.aries.transaction:type=jdbc,name=" + getResourceName());
props.put(Constants.SERVICE_RANKING, getInt(Constants.SERVICE_RANKING, 0) + 1000);
ds = new RecoverableDataSource();
ds.setDataSource(dataSource);
ds.setExceptionSorter(getString("aries.xa.exceptionSorter", "all"));
ds.setUsername(getString("aries.xa.username", null));
ds.setPassword(getString("aries.xa.password", null));
ds.setTransactionManager(transactionManager);
ds.setAllConnectionsEquals(getBool("aries.xa.allConnectionsEquals", true));
ds.setConnectionMaxIdleMinutes(getInt("aries.xa.connectionMadIdleMinutes", 15));
ds.setConnectionMaxWaitMilliseconds(getInt("aries.xa.connectionMaxWaitMilliseconds", 5000));
ds.setPartitionStrategy(getString("aries.xa.partitionStrategy", null));
ds.setPooling(getBool("aries.xa.pooling", true));
ds.setPoolMaxSize(getInt("aries.xa.poolMaxSize", 10));
ds.setPoolMinSize(getInt("aries.xa.poolMinSize", 0));
ds.setValidateOnMatch(getBool("aries.xa.validateOnMatch", true));
ds.setBackgroundValidation(getBool("aries.xa.backgroundValidation", false));
ds.setBackgroundValidationMilliseconds(getInt("aries.xa.backgroundValidationMilliseconds", 600000));
ds.setTransaction(getString("aries.xa.transaction", isXaDataSource ? "xa" : "local"));
ds.setName(getResourceName());
ds.start();
BundleContext context = reference.getBundle().getBundleContext();
registration = context.registerService(DataSource.class, ds, props);
}
Aggregations