Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
 * implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
package org.ops4j.pax.jdbc.pool.aries.impl.ds;
Creates pooled and optionally XA ready DataSources out of a non pooled DataSourceFactory. XA transaction handling Besides pooling this also supports to provide a DataSource that wraps a XADataSource and handles the XA Resources. This kind of DataSource can then for example be used in persistence.xml as jta-data-source
    private  static final Logger LOG = LoggerFactory.getLogger(AriesXaPooledDataSourceFactory.class);
    private AriesTransactionManager tm;

Initialize XA PoolingDataSourceFactory

dsFactory non pooled DataSourceFactory we delegate to
tm transaction manager (Only needed for XA mode)
        this. = tm;
    public DataSource createDataSource(Properties propsthrows SQLException {
        try {
            XADataSource ds = .createXADataSource(getNonPoolProps(props));
            RecoverableDataSource mds = new RecoverableDataSource();
            return mds;
        catch (Throwable e) {
            .error("Error creating pooled datasource" + e.getMessage(), e);
            if (e instanceof SQLException) {
                throw (SQLExceptione;
            else if (e instanceof RuntimeException) {
                throw (RuntimeExceptione;
            else {
                throw new RuntimeException(e.getMessage(), e);
New to GrepCode? Check out our FAQ X